How to create a shortcut in terminal for Mac for Sublime Text

Copy and paste the code below in ~/.bash_profile. You can edit the file by typing nano ~/.bash_profile

# Sublime Text alias
alias subl='/Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl'

For Sublime Text 2 it is

# Sublime Text alias
alias subl='/Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl'

Now you can type (without the $ of course)

$ subl ~/Downloads/some_file.txt

Happy coding! – Found a mistake or a typo? Please submit a PR to my GitHub-repo.

Get my next post right in your inbox via Blogsend
(I don't get your email address so I can't spam you)

Like this post? Follow @adriaanvrossum on Twitter