Site icon ChrisWrites.com

Unlock the Power of Symbolic Links – with or without the Terminal

Symbolic links (sometimes also called symlinks or soft links) are shortcuts that can point at any file, directory, app or utility, located anywhere on your Mac.

While symbolic links share many similarities with macOS’ better known alias feature, there are several important differences that make symbolic links much more powerful.

Firstly, you can use symbolic links to point at any item, including command line utilities and apps that don’t properly recognise aliases.

Symbolic links are also created at a much lower level in the file system, to the point where macOS won’t treat your symbolic link as a shortcut, but as the item it’s actually pointing at. This means that symbolic links have the potential to be much more than just shortcuts to your most frequently-used items: you can use them as stand-ins for any item on your system. Potentially, you could even relocate huge, memory-hogging system files and folders to an external storage device, replace the original item with a symbolic link, and your Mac will still act as though that item it available locally.

In this article I’m going to show you how to create symbolic links using your Mac’s Terminal, as well as sharing plenty of examples of interesting ways that you can use this feature.

And, just in case you’re unfamiliar with the Terminal but still like the sound of symbolic links, I’ll also be looking at a third party app that you can use to create fully-functioning symbolic links, without having to go anywhere near the Terminal.

Creating Symbolic Links

You create symbolic links using your Mac’s built-in Terminal:

You create symbolic links using ln -s, so type this part of the command into the Terminal, but don’t press the ‘Enter’ key on your keyboard:

ln -s

You then need to specify:

ln -s /location-you’re-linking-to         where-you-want-to-place-your-link/filename

For example, if you wanted to:

  1. create a symbolic link to the System Preferences app
  2. place this link on your Desktop
  3. name this shortcut ‘System

Then your command would look something like this:

ln -s /Applications/System\ Preferences.app /Users/jessicathornsby/Desktop/System

This creates a symbolic link to the System Preferences app and places it on your Desktop.

Alternatively, if you don’t want to spend time typing the full path of the item you’re linking to (or you don’t want to risk typos, formatting mistakes or other errors that have a habit of creeping in when you’re typing long file paths) then there is a shortcut:

This adds the item’s complete path to the Terminal, so you just need to specify where you want to create this link and what the link should be called, and you’re ready to run your command.

Creating links to hidden system utilities

You can create a symbolic link to any item on the system, which comes in particularly useful for advanced utilities that are hidden deep within macOS’ file system.

For example, macOS includes a powerful command line utility known as Airport that can be invaluable for configuring and troubleshooting your Wi-Fi connection, but it’s buried in a seriously obscure location – on my Mac it’s located at /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport /Users/jessicathornsby/Desktop/airport, which isn’t exactly easy to remember!

You can use symbolic links to ensure that Airport is only ever a few clicks away, for example here I’m creating a symbolic link to Airport and placing it within easy reach on my Desktop:

sudo ln -s /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport /Users/jessicathornsby/Desktop/airport

Linking to protected items

As long as you have admin rights, you can create symbolic links to locations in the system that you wouldn’t normally have access to, by adding the word ‘sudo’ to your Terminal command:

sudo ln -s /location-you’re-linking-to       where-you-want-to-place-your-link

Then, simply enter your admin password when prompted, and macOS will create your symbolic link.

Depending on your version of macOS, you might discover that System Integrity Protection (SIP) prevents you from creating symbolic links in certain areas of your system, even with the ‘sudo’ command. While it is possible to disable SIP, it plays an important role in preventing malicious software from accessing and modifying your system files, so you should only ever disable SIP temporarily, and make a point of re-enabling it as soon as possible.

If you do decide to temporarily disable SIP:

csrutil disable

csrutil enable

Offloading folders to another hard drive

If you’re running low on memory then you may want to use symbolic links to offload a file, folder or program to external storage, such as a separate mounted drive or even an online storage solution, such as DropBox.

For example, if you wanted to relocate your ‘Documents’ directory to a separate mounted drive (‘Storage’), then you’d need to move or copy your ‘Documents’ folder to your mounted drive, and then create a symbolic link using the following command:

ln -s /Volumes/Storage/Documents/ /Users/jessicathornsby/Documents

Your Mac will continue to act as though the ‘Documents’ folder is available locally – the only difference is that the burden of storing the ‘Documents’ folder is now managed externally.

If you do decide to use symbolic links to free up some memory, then you may also want to consider relocating your ‘Downloads’ folder, or some of the sub-folders in macOS’ ‘Library’ section, as this is where many apps and services store their files, for example any games you download from Steam will be stored in this area of the system.

Move Your iTunes Storage to another drive

If you own an iPad or iPhone, then you may be able to free up a significant amount of memory by moving your iPhone iTunes backup folder to an external drive.

Firstly, you’ll want to check whether the ‘Backup’ folder really is taking up more than its fair share of memory:

~/Library/Application Support/MobileSync/

If you do decide to move ‘Backup’ to external storage:

ln -s /Volumes/External/Backup/ ~/Library/Application Support/MobileSync/Backup

If you do ever want to move this folder back onto your local machine, all you need to do is delete the symbolic link, then drag the folder from external storage and drop it back in its original location.

Creating Symbolic Links without the Terminal

In this article we’ve explored several interesting ways that you can use symbolic links, but there are countless ways that you can use this flexible and powerful feature.

But, what if you’re unfamiliar or uncomfortable with entering commands into the Terminal? Does this mean that you can’t use any symbolic links?

Thankfully, there’s various third party apps that let you create symbolic links without ever touching the Terminal. In this section I’m going to show you how to setup and use SymbolicLinker, an app that adds a one-click ‘Make Symbolic Link’ option to macOS’ ‘Services’ menu:

Removing symbolic links

Deleting a symbolic link does not delete the item that it’s linking to, so the easiest way to remove a symbolic link is to drag it to your Mac’s Trash. However, if you already have the Terminal open then you can permanently and immediately delete a symbolic link, with the following Terminal command:

rm full-path-to-symbolic-link

For example:

rm /Users/jessicathornsby/Desktop/System

Exit mobile version