I have installed Sublime on my Mac Lion Laptop, and followed the guide here http://www.sublimetext.com/docs/2/osx_command_line.html but as always it did not work. I dont have a ~/bin directory on my Mac. Any help?
3 Answers
You could create the symlink in /usr/bin:
sudo ln -s "/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl" /usr/bin/subl
- 256
- 1
- 4
If you don't have a ~/bin directory, you can create one with mdkir ~/bin. This should allow you to follow the guide.
If you do this and Sublime is still not working for you after you've set everything up, then this new folder is probably not included in your $PATH (a list of folders that command-line shells search for executables). You can check if this is the case by running echo $PATH and see if it contains /Users/<your username>/bin. If you don't see the new folder we created in your $PATH, then you'll have to add it: Add folder to PATH
A more appropriate location to link the subl exceutable might be /usr/local/bin if it exists.
- 38,658
Create a
bindirectory in your home folder using the Finder or by typingmkdir ~/binin the terminal.Create a symlink to the
sublapp in thatbinfolder by typingsudo ln -s "/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl" ~/bin/sublin the terminal.Open or create a file called
.bash_profile(note the dot!) in your home directory using Sublime Text. (Your home directory will be the one in the Finder with the home icon. You can get the Finder to show the home directory quickly by typingopen ~in the terminal.)Add the
~/bindirectory to your$PATHby editing the.bash_profilefile you've just created and adding the lineexport PATH=$PATH:~/bin. Then save the file.Reload your .bash_profile so that the updated $PATH is picked up by typing
source ~/.bash_profilein the terminal.
You should now be able to use the subl command at the terminal prompt. It's also worth noting that you can put the bin folder anywhere you like if you don't want to put it in your home folder.
- 511