4

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

  • Can you either run rehash and try again, or open a new shell and try it there? Also, does it work if you enter the full path, /usr/local/bin/subl? – mrb Jul 5 '13 at 13:49
  • Just for completeness: I meant to say hash -r instead of rehash (which is for csh-likes). This will tell your shell to scan the PATH for executables, though I think bash does this automatically on 'command not found' anyway. – mrb Jul 5 '13 at 19:22
6

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.)

| improve this answer | |
  • 1
    @pitosalas it is generally a good idea to build your command lines using tab-expansion when possible. Just start writing a path and hit tab to see the completions. That way, you know you have the right path. – terdon Jul 6 '13 at 2:32
  • 1
    @terdon: I do... But that was what got me in trouble! On Mac, when I tab expand a path containing a space in a directory name, even with a quote, it inserts the backslash to escape the space! – pitosalas Jul 8 '13 at 1:04
  • 1
    @pitosalas yes, but if the shell escapes everything it needs to escape, you no longer need to quote the path. My point is you either build the path with tab expansion, or you quote it in which case you should not escape characters because they are already quoted. – terdon Jul 8 '13 at 1:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.