On a Mac, how do you make folder and file “shortcuts”? Say you have a folder somewhere, and you want a quick and easy way to access it from your desktop or another area. You probably want to make a “shortcut” on your desktop that, when clicking on it, will bring you to that folder. There are basically two ways you can make a “shortcut” on a Mac: symbolic links and aliases. But what are these, how do you use them, and what’s the difference?
Aliases you should be familiar with. Right click (or Command (⌘)–L) on a folder and you can select the option “Make Alias.” Pretty easy, in fact, look how short Apple’s official instructions are for Mountain Lion.
When you do this, a new folder should appear that is called “FolderName Alias,” where FolderName is whatever the original folder was called. You can make as many aliases as you want, and put them wherever you want.
Say you create folder B and make an alias A, so that clicking A brings you to folder B. The way an alias works, A is using an ID that represents B. This may not be super intuitive, but it’s really beneficial in one way in particular – if you move B, it doesn’t matter. No matter what you do to B, where you move it (as long as it’s still on your computer), A will point to B. Pretty neat.
So why would you ever want to use anything besides an alias? Well sometimes, programs don’t get along with aliases. What’s an alternative? Symbolic Links.
Symbolic links don’t work with IDs, they work with file location. So if A and B were set up with a symbolic link instead of an alias, and you then moved B somewhere else, A isn’t going to work anymore. Sounds inconvenient, and why is this any different than an alias?
Well, here’s the thing, when a program goes to A, it doesn’t see a pointer to B. It sees B. For all any program knows, B is there. Everything in B is there. There aren’t any pointers to anything. Now that’s cool.
On top of that, aliases can’t be used in terminal. Symbolic Links can. If you do try to use an alias in terminal, the commands you use won’t be able to follow the reference and get to the original folder.
Make a Symbolic Link
But how do you make a symbolic link?
It’s actually very easy, you do it using a command in terminal – ln
It’s important to note, however, that you need the flag -s to make a symbolic link. If you want “MyFolderLink” to reference “MyFolder” via symbolic link, you need to use the command
As you can see in the picture above, MyFolderLink points to MyFolder, this is representative of the symbolic link between the two.
And you’re all set!
If you don’t use the flag -s, you will create a “hard link.” This works a little differently. As we know, symbolic links (sometimes called soft links) reference a location, a filepath. Hard links reference the actual bits on the physical drive. A folder hard linked to another folder doesn’t really reference that other folder, it references the literal data that that other folder contains.
If you delete the information that the hard link is pointing to, the hard link will still continue to point to those bits on the disk – doesn’t matter if they’re empty. This is not the case with aliases or symbolic links – if you delete the original stuff you want to point to, the links will point to nothing. At the most abstract, simplest level, you can think of hard links as pointing to the physical location on the drive where the information you want is located.
This is a little more abstract, and generally between an alias and a symbolic link, you should be all set for making shortcuts.
So now you should know how to make more folder shortcuts than you know what to do with! Aliases are almost always enough, and are super convenient. Symbolic links are a great alternative to know about though, if even just for those picky applications that can’t use aliases correctly. Dropbox is a great example of one such application.
If you want to get more technical, the manual page (for ln) from Apple has a lot more details. Or, if you just want a light summary about the command, check out this site.
Go on and practice, make some shortcuts!