I\'m having difficulty getting this set up. I fixed my .bash_profile
, and created the symlink using the following command from the Sublime website:
While sarbottam's answer is the proper way to do it, if you're lazy like me, and use subl to just do an subl .
, you can add an alias to your ~/.bash_profile
alias subl="/Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl"
and either open a new terminal window or run the .bash_profile
This is what worked for me.
First, make sure you are in home folder:
cd ~
Step 1: Remove the /Users/Ram/bin/subl
directory by using following command line:
rm -rf /Users/Ram/bin/subl
Step 2: Create this folder again using following command line:
mkdir /Users/Ram/bin/subl
STEP 3: use the following command to create a symbolic link to sublime:
sudo ln -sv "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" /usr/local/bin/subl
(using sudo
before this command overrides permission issues)
Step 4: Now you can test if subl
works:
subl test.py
This should open up sublime with new test.py
file created.
This solved my Sublime terminal (subl
) command issue after battling for a while on Yosemite:
sudo su
rm /usr/local/bin/subl
ln -s "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" /usr/local/bin/subl
exit
Here is the source.
I'm documenting this because it worked on my machine and might fix the problem for people who see "file already exists` when they run the command suggested in sarbbottam's answer. I'm not sure I can fully explain it so I may use the wrong terms.
When I copy/pasted sarbbottam's command, my terminal reported that the file already existed. I tried copy/pasting several Stack Overflow answers to this problem into my terminal, so I had symlinks called subl
and sublime
in my /usr/local/bin
directory. I could see the file when I listed all files in that directory with ls -a
. I tried to open the subl
directory in a text editor, and it said that the file didn't exist.
I deleted the subl
symlink in /usr/local/bin
, ran the command, and it worked.
I think I accidentally made one for Sublime Text 2 or something, and just figured I'd be overwriting the last one which was not the case.
If you are using Sublime Text 2 try this:
$ ln -s "/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl" /usr/local/bin/subl
or, if your path is in /usr/bin/ instead /usr/local/bin:
$ ln -s "/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl" /usr/bin/subl
There might be an issue with having multiple symbolic links to the same target. I removed my link "subl" and my link "sublime" still works.