Open Sublime Text from the Mac Terminal

Written by Michael Lee 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
Thanks for taking the time to read this article. I'd love to stay in touch and share more tips on programming and design, side projects and working remotely. Sign up and I'll send you my articles straight to your email.

:wave: Hey hey, I'm Michael Lee! I really appreciate you taking the time to read this article.

Be sure to check out my other articles.