MacOS – OS X won’t create any symbolic links, creates aliases instead

aliasmacossymlinkterminal

No matter how I try to create an symbolic link OS X refuses to play along and instead creates an alias. I've tried several tools and also through the terminal using the ln command.

I am on a fresh install and using the ln command worked fine before. Any idea what's up?

Thanks,
Will

Best Answer

Let's try a few experiments, and look at a few things.

In a terminal emulator, such as Terminal.app in /Applications/Utilities, go to your home directory (cd ~) and create a directory (mkdir [directory]).

Make sure you go in the directory we just created (cd [directory]).

cd ~
mkdir directory
cd directory

After that, make a file; a simple text file will do:

echo "This is a simple text file" > originalfile.txt
ls -l@

Now, try creating a hard link, like this:

/usr/bin/ln originalfile.txt hardlink.txt

Then, try creating a symbolic link, like this:

/usr/bin/ln -s originalfile.txt symboliclink.txt

Now, open the directory in Finder with open . and make an alias.

In the terminal emulator you opened before, another ls should get us this:

Testarossa:test tonyw$ ls -l@
total 2528
-rw-r--r--  2 tonyw  staff      19 25 Jan 15:51 file.txt
-rw-r--r--@ 1 tonyw  staff  426048 25 Jan 15:52 file.txt alias
com.apple.FinderInfo        32 
com.apple.ResourceFork  850686 
-rw-r--r--  2 tonyw  staff      19 25 Jan 15:51 hard.txt
lrwxr-xr-x  1 tonyw  staff       8 25 Jan 15:53 symbolic.txt -> file.txt

The Finder GUI should result in this, too:

The Finder GUI with the original file, a hard link, and a symbolic link.

Please note that the Finder GUI displays a symbolic link as an alias.

A symbolic link is not the same thing as an alias. A real alias has extended attributes than a symbolic link.

In the Finder GUI, there is no way of telling a hard link is anything but a file.

For any symbolic links, there is an 'l' at the left hand end of the attributes, and the ls command tells us where it points.

When you try this, exactly what do you get?