Alias can’t be opened

aliasfinder

This is about a MacBook running on 10.10.5 whose disk has recently been repaired (to try to solve the present issue) using Disk Utility. I created an alias as follows:

$ cd ~/Desktop
$ ls -ld
drwx------+ 13 erwann  staff  442 Jul 14 12:41 .
$ touch foo.bar
$ mkdir baz
$ ln -s foo.bar baz   
$ ls -l baz
total 8
lrwxr-xr-x  1 erwann  staff  7 Jul 15 11:02 foo.bar -> foo.bar

Next, I use Finder to 'Show [the] original' associated with the alias created in 'baz'. I get:

The alias “foo.bar” can’t be opened because the original item can’t be found.

Any suggestion to fix this?

Best Answer

The link needs an absolute path.

ln -s foo.bar baz

will create an alias in baz pointing to the file foo.bar. But the file baz/foo.bar does not exist, hence the error you received.

You want:

ln -s ~/Desktop/foo.bar baz

which will create an alias in the baz directory pointing to ~/Desktop/foo.bar.