Trying to get Sublime Text 3 working from terminal

bashsublimetextterminal

I am trying to get the Sublime Text to work with Git from the following tutorials
http://www.sublimetext.com/docs/3/osx_command_line.html and https://help.github.com/articles/associating-text-editors-with-git#using-sublime-text-as-your-editor

I created a bin directory with mkdir ~/bin and run the line ln -s "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" ~/bin/subl I have then tried the command subl --help but get the following error

-bash: subl: command not found

If I go to my Finder I can see subl in the bin folder in my username. What am I doing wrong?

Best Answer

You need to add ~/bin to your PATH variable. In Terminal, type cd to return to your home directory. Then, type bin/subl .profile to open your ~/.profile file. If it doesn't exist, Sublime will just create an empty file. Add this line to it:

export PATH=$HOME/bin:$PATH

and save the file. Close out of Sublime, and restart Terminal. You now should be able to use the subl command from any directory.