I've tried three different ways to create a symbolic link to Sublime Text on my Mac and, after restarting terminal each time, it still keeps telling me command not found. I'm using a Mac with Yosemite (OSX Yosemite, 10.10). How can I create a symbolic link so I can open Sublime with the sub
command?
One
ln -s 'Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl' /bin/sub
Two
ln -s "Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl" /bin/sub
Three (no quotes)
ln -s Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl /bin/sub
Best Answer
You're missing the '/' at the beginning of your app and
sudo
as/bin
is owned byroot
and you can't actually write to it as a normal user. As you currently have it, it would only work if your present directory was the system root. This assumes of course that the Sublime Text app is in your main Applications folder.Try this…
One afterthought: It's considered bad practice to change the content of
/bin
and/usr/bin
because any upcoming OS X upgrade may wipe the content there./usr/local/bin
is the usual place to install user-provided binaries in, somight be the better option.
Or (as you probably never need to run Sublime Text from within a shell script), simply define a bash alias
which should be added to your bash startup file to make it stick