8

I realized today that an alias is not the same thing as a soft link in Lion. I made an alias of a folder in my Dropbox folder and moved the alias to my Desktop.

When I try to cd into this alias in terminal, the terminal notes that the alias is not a folder. In Ubuntu, I can, however, cd into a soft link.

How can I create a soft link in Lion? It would be convenient for me because I write python scripts that rely on soft links.

2 Answers 2

8

You can create soft links (a.k.a. symbolic links or symlinks) from the terminal, the same way as in any other Unix system.

I'm not familiar with Dropbox so I'll make up an example assuming that there is a folder Dropbox in your home directory:

cd ~ ln -s ~/Dropbox/aFolder Desktop/aFolder 

Note that ln takes the link to create as its second argument; think of it like cp.

Also, a warning: if you create a soft link with a relative path, for example

cd ~/Desktop ln -s ../Dropbox/aFolder aFolder 

then the link will be relative to its location at the moment, not to the current directory when you created it! So, for example, if you moved it into ~/Desktop/Folders then it would be pointing at ~/Desktop/Dropbox instead of ~/Dropbox.

3

You must use the Unix ln command from Terminal.

ln -s existingname newname 

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.