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\ /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

//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 articles like this one in your inbox. Sign up for my newsletter.