3
me$ ln -s ~/x/y/ ~/Desktop/
ln: /Users/me/Desktop//: File exists

Why does this attempt at creating a symbolic link to ~/x/yon the Desktop now work? The only way I can seem to get something like a symbolic link is this way:

ln -s * ~/Desktop/

I'm confused, this was really simple in Ubuntu.

2 Answers 2

2

Alternatively, you can do

ln -s ~/x/y ~/Desktop/

(note there's no slash '/' character after ~/x/y/).

I think the error message is not the most informative, but I understand it as that if you're putting a trailing slash, you're referring to the content of your directory (in this case ~/x/y), but if you omit it, you're referring to the directory itself.

7
  • 1
    Of course this one doesn't. You've done ln -s ~/Desktop/symlink ~/Desktop/ which makes a symlink onto itself (there already is a ~/Desktop/symlink file in there, you can't link it to itself). If you do ln -s ~/tmp/symlink ~/Desktop/ it should work.
    – mike
    Commented Oct 27, 2013 at 20:36
  • Hmm, now it lets me make the symlink, but the symlink shows the default file icon (instead of the folder icon) and attempting to open the symlink shows an error
    – grg
    Commented Oct 27, 2013 at 20:39
  • 1
    Again, can you paste in the commands and their output exactly as you've typed them? Difficult to tell without seeing them.
    – mike
    Commented Oct 27, 2013 at 20:56
  • 1
    Here's my Terminal output. Getting the same error as @Tor when attempting to open symlink.
    – grg
    Commented Oct 27, 2013 at 20:57
  • 1
    Hmm... I'll be honest with you. I've done the exact same thing on my system (OSX 10.9) and it works perfectly... beats me!
    – mike
    Commented Oct 27, 2013 at 21:01
1

ln -s ~/x/y/ ~/Desktop/ attempts to symlink ~/Desktop/ to ~/x/y/, which does not appear to be what you wanted, and is indeed not possible since ~/Desktop exists (as the error states).

To create a symlink to ~/x/y/ inside ~/Desktop/, you need to give it a name like so:

ln -s ~/x/y/ ~/Desktop/mysymlink

This creates a symlink mysymlink on your desktop that links to ~/x/y/.

You must log in to answer this question.