How To Create Symlinks On Your Mac.
A symbolic link, often shortened to a symbolic link, is a type of link that is stored in one location on your computer and points to another location on the same computer. You can think of this as an application shortcut. Even though the actual application file is deep inside your folders, you can simply double-click the application’s shortcut on the desktop to launch the application.
A symbolic link is a type of shortcut, but it works differently than regular shortcuts. It is not so much a shortcut as the file itself it points to. Any application you provide with your symlinks will treat these links as actual files, not just regular shortcut files.
They are extremely useful as you don’t need to bind to a specific folder for the app to work. You can store your data in other folders, and you can create a symbolic link in the original folder pointing to the new folder you created. Your system and applications will think that you have not actually made any changes and will work fine, although this is not the case.
Create a symbolic link using Terminal
It’s very easy to create a symbolic link on a Mac. The built-in Terminal app has a command that makes it easy to create as many symbolic links as you want on your Mac.
All you need to know is where you want to create the symbolic link and the path that the symbolic link should point to. With this information, you can create a symbolic link in Terminal.
Launch the Terminal application on your Mac in the way you want.
Enter the following command into the Terminal window and press Enter. Remember to replace the destination with the folder you want the link to point to and the location with the path where you want to save the link.
ln -s destination location
To create a symbolic link on your desktop pointing to the Documents folder, you must use the following command:
ln -s / Users / Mahesh / Documents / Users / Mahesh / Desktop
A symbolic link will be created and saved to your desktop. Double click on it and it will open the Documents folder (if that’s what you listed above) in Finder.
If there are spaces in the names of the directory for which you want to create a symbolic link, be sure to enclose the path names in double quotes to avoid errors.
You can now use this symbolic link in any of your commands and applications, and it will be considered the actual version of your folder or file.
Use an application to create a symbolic link
Terminal isn’t the only way to create symbolic links on your Mac. If you are not a terminal expert, you have an application that allows you to create symbolic links on your computer.
What this app does is that it adds an option to your context menu so that you can create symbolic links simply by right clicking on your files and folders.
Go to the SymbolicLinker GitHub page, download and open the package on your Mac.
Optionally copy the SymbolicLinker.service.app file from the package, click the Go menu in Finder, choose Library, open the Services folder, and paste the copied file.
Double-click an 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 for which you want to create a symbolic link, right-click it and select Services and then Make Symbolic Link.
The symlink will be created in the same folder as the original file / folder. You can move it around if you like.
Create symbolic links with the Automator service
Automator’s method for creating symbolic links works in much the same way as the method described above. But this one will suit those of you who don’t trust any random apps on the internet and would rather create something yourself so you know exactly what it contains.
Launch the Automator app on your Mac.
Select Service and then Select to create a new Automator service on your Mac.
Set the following options at the top:
The service gets the selected – files or folders
to – any application
In the list of actions, find the action named Run Shell Script and drag it to the right pane.
Configure the action and commands as follows:
Shell – / bin / bash
Pass input – as arguments
while [$ # -ne 0]; do
ln -s “$ 1” “symlink $ 1”
Save the service by clicking the File menu at the top and choosing Save. Enter a friendly name for the service and click Save.
To create a symbolic link to the Automator service you just created, right-click the file or folder and select Services and then the name of your service.
You can also create a keyboard shortcut for the service to make it easier to create symbolic links on your computer.
Delete symbolic link on Mac
Symbolic links do not take up much memory space as they are simply shortcuts to files and folders on your computer. However, if you want to remove one or more of them from your computer, you have two ways to do it.
Launch the Terminal application, type the following command and press Enter. Remember to replace the symbolic link with the path to the symbolic link on your Mac.
symbolic link rm
Another way to remove a symbolic link is to use the context menu option. Right click on your symbolic link and select “Move to Trash”. The symlink will be removed from your Mac.
Remember to empty the trash after removing the symlink to make sure it’s gone from your Mac forever.
Symbolic links are much more powerful than regular aliases because they work in all applications and commands as if they were real files.