Thursday, July 25, 2013

Run Sublime Text Editor from Terminal/Bash (Mac)

Just recently started using Sublime Text Editor after working with WebStorm and other editors/IDE's, and I have to say I'm pretty much hooked. 

If you are using a mac, you'll quickly end up wanting to fire up an instance of sublime from the terminal (bash command line). If so, you can register the "subl" command by doing the following:

1. Open up the terminal

2. Execute:ln -s "/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl" ~/bin/subl

3. Make sure ~/bin is added to your $PATH by doing the following:

3.1 Enter cd ~/ (go to your home folder)
3.2 Enter "touch .bash_profile" to create your bash profile if it does not yet exist
3.3 Enter "open -e .bash_profile" to open the file in TextEdit
3.4 Paste in this text:
PATH=$PATH:~/bin
export PATH
3.5 Enter ". .bash_profile" to reload .bash_profile and update any functions you add.
Happy coding! 

No comments:

Post a Comment