Bash – Executable symbolic link file not working

bashfilenamesquoting

On Mac OSX, I am having trouble with a pretty simple thing. My symbolic link doesn't want to execute. Can you help me spot the trouble? Thanks!

$ echo $PATH
/Users/pitosalas/.rbenv/shims:/usr/local/bin:/usr/local/git/bin:/usr/bin:/bin:/usr/sbin:/sbin

$ ls -l /Applications/Sublime\ Text.app/Contents/SharedSupport/bin
total 320
-rwxr-xr-x@ 1 pitosalas  admin  160688 Jun 27 00:27 subl

$ ln -s "/Applications/Sublime\ Text.app/Contents/SharedSupport//bin/subl" /usr/local/bin/subl

$ chmod 755 /usr/local/bin/subl

$ ls -l /usr/local/bin/subl
lrwxr-xr-x  1 pitosalas  admin  63 Jul  1 16:36 /usr/local/bin/subl -> /Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl

$ subl
-bash: subl: command not found

Response to comment:

What rehash? You don't mean rbenv rehash do you? Also here's the command in a new shell:

/usr/local/bin/subl

-bash: /usr/local/bin/subl: No such file or directory

Best Answer

Remove the \ from your ln command if you're using quotation marks:

ln -s "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" /usr/local/bin/subl

(There was also a double / before bin, but that doesn't actually prevent the OS from finding the file, and it looks like it got removed anyway.)

Related Question