Symbolic links, why doesn't this work:

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.


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.


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