Assuming you installed Sublime in the Applications folder
For Sublime Text 2:
$ open /Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl
For Sublime Text 3:
$ open /Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl
If that worked, you're good to go.
You now need to create a symlink called sublime which links the subl CLI to a folder where your system usually looks to execute these binaries.
For Sublime Text 2:
$ ln -s /Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl /usr/local/bin/sublime
For Sublime Text 3:
$ ln -s "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" /usr/local/bin/sublime
$ nano ~/.bash_profile
Now add the following
export PATH=/usr/local/bin:$PATH
Finally, if you did have to add /usr/local/bin to your PATH, run the following command before continuing:
$ source ~/.bash_profile
This will reload your .bash_profile with the newly added directory in your PATH.
sublime .
– opens the current directory in Sublimesublime <file-name>
– opens a file where filename is the file to be openedsublime <folder-name>
– opens a folder where foldername is the folder to be opened