Open Sublime Text from the Mac Terminal

Written on August 27, 2014

Sublime Text, like MacVim has a useful command line tool that allows you to open Sublime Text and files in Sublime Text from the Mac Terminal.

Setting this up is pretty straight forward. Simply enter this command in Terminal:

ln -s /Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl /usr/local/bin/subl

What the command does is create a symlink of the command line tool in your bin folder. The bin folder is where other executable binary files exist.

While creating the symlink, Terminal might complain about not being able to execute the command. If this happens, simply add sudo in front of the command and type in your login password.

Now that the tool is installed you can execute commands like these from Terminal:

//Opens Sublime Text
subl

//Opens current directory in Sublime Text
subl .

//Opens file in Sublime Text
subl filename

Stay in touch

Thanks for reading this article. I'd love to stay in touch and share more tips on programming and side projects with you. Sign up and I'll send you my articles straight to your email, you'll also get a free copy of the light themed version of my Git cheat sheet.
Git cheat sheet preview image