Having loads of difficulty getting this set up. I've fixed up my .bash_profile
, created the symlink using the following command from the sublime website:
ln -s "/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl" ~/bin/subl
Yet when I input that command I get:
ln: /Users/my_username/bin/subl: No such file or directory
It appears my terminal is looking at the wrong place for the file? Why is it trying to point to a bin
folder on my home directory?
This solved my sublime terminal (
subl
) command issue after battling for a while on Yosemite here is the sourceThere might be an issue with having multiple symbolic links to the same target. I removed my link "subl" and my link "sublime" still works.
Launch Sublime Text from the command line on OSX
Following the directions above are what worked for me. I use Sublime Text 3 and only had to c+p the below into the cli. I did this at the root level
$ cd ~
If your using Sublime Text 3 c+p this into the command line:
If your using Sublime Text 2 c+p this code below into the command line:
Now test it out to see if it works
Open a new file from the command line:
Open a project folder
Launch Sublime app:
To open Sublime Help for more detailed options use:
I'm gonna document 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 here or there.
When I dutifully copy-pasted sarbbottam's command, my terminal reported that the file already existed. I had 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: I could see the file when I listed all files in that directory with "ls -a". So I tried to open the "subl" in a text editor, and it said that the file didn't exist!
So 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.
create the symlink in
/usr/local/bin
instead of~/bin
and make sure that/usr/local/bin
in inPATH
.If you don't find
/usr/local/bin/
, then add the following lines to your .bashrc or .zshrcGeez louise, this was irritating to figure out. I tried several combinations of using sudo and also including or excluding leading / and escaping spaces in the package name Sublime\ Text.app
For me, what worked for creating the desired symlink was:
I did not have to use sudo or modify $PATH. For reference, I am on Mac OS Mojave 10.14. echo $PATH currently (and without any modification by me) shows the following:
You can tell if this worked by typing "which subl" immediately after running the ln command above. If you don't get a line of output showing you where bash found your subl command... then you don't have it. Best of luck!