How to Create Iconic Links on Your Mac

A symbolic link, often shortened to a symlink, is a type of link that is stored at one location on your machine and points to another location on the same machine. You can think of it as a shortcut to an application. While the actual app file is located deep inside your folders, you can simply double-click the app shortcut on the desktop to launch it.

Symbolic links are a type of shortcut, but they work differently from regular keyboard shortcuts. It’s not a shortcut and more of the actual file it points to. Any application you provide with your symlinks will treat these links as real files instead of normal shortcut files.

These are extremely useful because you don’t have to be stuck to a specific directory for an application to work. You can store your data in other directories, and you can create a symlink in the root directory that points to the new directory you created. Your system and your applications will think that you haven’t actually made any changes and they will function normally, even though things are different.

Create a symbolic link using the terminal

Creating an iconic link on a Mac is super easy. The built-in Terminal app has a command that allows you to easily create as many symlinks as you want on your Mac.

All you need to know is the location where you want to create the symbolic link and the path the symbolic link will point to. After you have this information, here’s how you create a symlink in Terminal.

Launch End application using your preferred way on your Mac.

Type the following command into the Terminal window and press enter. Guaranteed replacement destination with the directory you want the link to point to and location with the path where you want to save the link.

destination location in -s

Terminal window with command: ln -s destination location

To create an icon link on your desktop that points to your Documents folder, you would use the following command:

ln -s /Users/Mahesh/Documents/Users/Mahesh/Desktop

Terminal window with command: ln -s /Users/Mahesh/Documents/Users/Mahesh/Desktop

An icon link will be created and saved on your desktop. Double-click it and it will open the Documents folder (if that’s what you specified above) in Finder.

Document icon link

If the folder you want to create a symbolic link for has a space in its name, make sure to enclose the path name with quotes to avoid any errors.

You can now use this symbolic link in any of your commands and applications and it will be treated as the actual version of your folder or file.

Use the app to create an icon link

Terminal is not the only way to create symlinks on your Mac. If you’re not a Terminal guy, you have an application available that allows you to create symlinks on your machine.

What this app does is it adds an option to your context menu so that you can create symlinks by simply right clicking on your files and folders.

Go to the SymbolicLinker page on GitHub and download and open the package on your Mac.

Copy SymbolicLinker.service.app file from package, keep Right to buy key, click To go in Finder, select Libraryopen Service and paste the file you copied.

Service Directory with the SymbolicLinker app

Double-click the app to open it. It won’t show anything but it has secretly added an option to your context menu.

Find the file or folder you want to create the symbolic link for, right click on it and select Service Followed by Create symbolic link.

Right click on Create Symbolic Link menu in Selected Service

It will create the symbolic link in the same directory as the original file/directory. You can move it if you want.

Create symbolic links using automation services

The Automator method for creating symlinks works pretty much the same way as above. But this one will work for those of you who don’t trust any random apps on the Internet and you want to create something yourself so you know exactly what it contains.

Launch Automation app on your Mac.

Option Service Followed by Choose to create a new Automator service on your Mac.

Create a new Automation Services window on Mac

Set the options at the top as follows:

Service to receive selected files – files or folders

in – any application

Service for getting selected file or folder preferences in Automator

In the action list, search for the action named Run shell script and drag it to the right panel.

Run Shell Script action

Configure actions and commands as follows:

Shell – /bin/bash

Pass input – as argument

while [ $# -ne 0 ]; do
ln -s “$1” “$1 symlink”
change
accomplished

Run the Shell Script configuration window

Save the service by clicking File menu at the top and select Save. Enter a meaningful name for the service and press Save.

Save service as window

To create a symbolic link with the newly created Automator service, right-click your file or folder and select Service followed by your service name.

Right click on the menu select Set Icon Link

You can also create a shortcut for the service to make it easier to create symlinks on your machine.

Remove symbolic links on Mac

Symbolic links don’t take up much memory as they are just shortcuts to files and folders on your machine. However, if you want to remove one or several of these from your machine, you have two ways to do it.

Launch End application, enter the following command and press enter. Guaranteed replacement symbolic link with the path of the symbolic link on your Mac.

rm . icon link

Terminal with the command: rm symlink

Another way to remove the icon link is to use the context menu option. Right click on your icon link and select Move to Trash. It will remove the symbolic link from your Mac.

Right-click the Move To Trash menu

Make sure to empty the Trash after you delete the icon link to make sure it works fine on your Mac.

Inference

Symbolic links are much more powerful than regular aliases because they work in all applications and commands as if these were real files.

Leave a Reply

Your email address will not be published.