18

I have two aliases in my home directory: devbootcamp and bookshelf. I can cd into devbootcamp but not bookshelf but I'm not sure why. I don't remember how I made the alias to devbootcamp but I followed this tutorial to create the bookshelf alias. Also strangly in my terminal devbootcamp is purple but bookshelf is not. How do I make it so they have the same functionality?

enter image description here

17

If you are trying to cd into an alias, it will not work; this is by design as an alias works at the Finder level, not the underlying UNIX level.

I have excerpted some of the key aspects of aliases, symbolic links (symlinks), and hard links from the article "What Are Aliases, Symbolic Links, and Hard Links in Mac OS X?" below.


Aliases

This type of shortcut is the oldest for the Mac; its roots go all the way back to System 7. Aliases are created and managed at the Finder level, which means that if you're using Terminal or a non-Mac application, such as many UNIX apps and utilities, an alias won't work. OS X seems to see aliases as small data files, which they are, but it doesn't know how to interpret the information they contain.

Symbolic Links

This type of shortcut is part of UNIX and Linux file systems. Because OS X is built on top of UNIX, it fully supports symbolic links. Symbolic links are similar to aliases in that they are small files that contain the pathname to the original object. But unlike aliases, symbolic links don't contain the inode name of the object. If you move the object to a different location, the symbolic link will be broken, and the system won't be able to find the object.

Hard Links

Like symbolic links, hard links are part of the underlying UNIX file system. Hard links are small files that, like aliases, contain the original item's inode name. But unlike aliases and symbolic links, hard links don't contain the pathname to the original object. You would typically use a hard link when you want a single file object to appear in multiple places. Unlike with aliases and symbolic links, you can't delete the original hard-linked object from the file system without first removing all hard links to it.

What works in both Terminal & Finder

Just create a symlink in Terminal

ln -s <path to some folder> <destination of link>

For example, on my Desktop, I created a symlink to my /Volumes folder

ln -s /Volumes /Users/allan/Desktop/Volumes

On my Desktop, I got this icon automagically:

enter image description here

You can even give it a different name:

ln -s /Volumes /Users/allan/Desktop/Stuff

And automagically...

enter image description here

  • Great explanation. It helped me to think about it abstractly ln -s [what/dir] [to/where] – DaveWoodall.com Dec 20 '18 at 17:02

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .