A symbolic link, often abbreviated to symbolic link, is a type of link that is stored in one location on the machine and points to another location on the same machine. You can think of it as a shortcut to an app. Even if the actual app file is inside your folders, you can simply double-click the app shortcut on the desktop to launch the app.
A symbolic link is a type of shortcut, but it works differently than regular shortcuts. It’s less of a shortcut and more of the actual file it points to. Any apps that come with your symlinks will treat these links as actual files rather than regular link files.
These are extremely useful as you don’t have to be locked in a particular folder for an app to work. You can have your data stored in other folders and you can create a symbolic link in the original folder pointing to the new folder you created. Your system and apps will think you haven’t really made any changes and will work normally, even if things are different.
Creating a symbolic link using the terminal
Creating a symbolic link on a Mac is extremely simple. The built-in Terminal app has a command that allows you to easily create as many symbolic links 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 that the symbolic link should point to. Once you have this information, here’s how to create a symbolic link in Terminal.
Start the terminal app using the preferred way on your Mac.
Type the following command in the Terminal window and press log into. Be sure to replace destination with the folder to link to e Position with the path where you want to save the link.
ln -s target location
To create a desktop symbolic link that points to the Documents folder, you need to use the following command:
ln -s / Users / Mahesh / Documents / Users / Mahesh / Desktop
A symbolic link will be created and saved on the desktop. Double-click on it and it will open the Documents folder (if that’s what you specified above) in the Finder.
If the directory you want to create a symbolic link for has spaces in its names, be sure to enclose the path names in double quotes to avoid errors.
You can now use this symbolic link in any command and app and it will be treated as the actual version of your folder or file.
Use an app to create a symbolic link
Terminal isn’t the only way to create symlinks on your Mac. If you’re not a Terminal type, you have an app available that allows you to create symlinks on your machine.
What this app does is add an option to the context menu so that you can create symbolic links just by right clicking on files and folders.
Go to the SymbolicLinker page on GitHub and download and open the package on your Mac.
Copy the SymbolicLinker.service.app file from the package, press and hold the key Option button, click to go menu in the Finder, select Libraryopen the Services folder and paste the copied file.
Double-click the app to open it. It won’t show anything but has secretly added an option to the context menu.
Find the file or folder you want to create a symbolic link for, right-click on it and select Services followed by Create a symbolic link.
It will create the symbolic link in the same folder as the original file / folder. You can move it anyway if you want.
Create symbolic links using an automation service
The Automator method of creating symbolic links works in much the same way as the method above. But this suits those of you who don’t trust any random apps on the internet and would rather create something yourself so you know exactly what’s in it.
Start the Automaton app on your Mac.
To select Service followed by Choose to create a new Automator service on your Mac.
Set the options above as follows:
The service receives selected – files or folders
in – any application
In the list of actions, look for the action named Run the shell script and drag it to the right panel.
Configure the action and commands as follows:
Shell – / bin / bash
Pass input – as arguments
while [ $# -ne 0 ]; Do
ln -s “$ 1” “$ 1 symbolic link”
move
done
Save the service by clicking on File top menu and selecting Save. Enter a meaningful name for the service and press Save.
To create a symbolic link with the newly created Automator service, right-click the file or folder and select Services followed by the name of the service.
You can also create a keyboard shortcut for the service to make creating symbolic links on your machine even easier.
Deleting a Symbolic Link on Mac
Symbolic links don’t take up much memory space as they are just links to files and folders on your computer. However, if you want to remove any or some of these from your machine, you have two ways to do it.
Start the terminal app, type the following command and press log into. Be sure to replace symbolic link with the path of the symbolic link on your Mac.
symbolic link
Another way to delete a symbolic link is to use the context menu option. Right-click the symbolic link and select Move to Trash. It will remove the symbolic link from your Mac.
Make sure to empty the Trash after removing the symbolic link to make sure it’s gone forever from your Mac.
Conclusion
Symbolic links are much more powerful than normal aliases as they work in all apps and commands as if they were real files.