Home > Wiki Tips

Symlink on Mac: What It Is And How to Create/Delete It

Updated on Monday, April 29, 2024

iBoysoft author Amanda Wong

Written by

Amanda Wong
Professional tech editor

Approved by

Jessica Shee

English Français Deutsch やまと Español Português

An Introduction to the Symbolic Link/Symlink on Mac

Summary: This post provided by iBoysoft walks you through all you need to know about the symlink on Mac. After reading, you will know what the symlink is on Mac and how to create and delete a symlink on Mac.

symlink mac

Multiple forms of shortcut links to files and folders are supported by the OS X and macOS operating systems on the Mac. Accessing items hidden deep within the file system is simple with shortcut links. Symlink is one type of them. keep reading to learn more about it.

 

A symbolic link, also known as a symlink, is a sort of link that is stored in one place on your computer and directs access to another place on the same machine. It can be compared to a shortcut to an app. Although the actual app file is hidden deep within your files, you may open the app by just double-clicking on the shortcut on your desktop.

In short, symlink is a special file that directs the system to the linked file/folder on your Mac. When you double-click the symlink on your Mac, it will open the file/folder it links to, therefore, you can quickly access the target item without expanding directories one by one in Finder.

You may think the symlink is similar to the alias on Mac, but the symlink is more advanced. It works in every application on the system, including command-line utilities such as Terminal. Besides, symlink doesn't contain the inode of the object and finds the object with its pathname, it continues working even if there are other files with the same name.

This part will guide you to create symlinks on Mac in different ways. The built-in tool Terminal can help to create symlinks on Mac. Another macOS app Automator can also add a Finder menu option to create symlinks in one click. Besides, some third-party apps can also easily create symlinks on your Mac.

Create symbolic links with Terminal

  1. Navigate to Finder > Applications > Utilities > Terminal to launch Terminal.
  2. Run the ln command in the following form. ln -s /path/to/original /path/to/link For example ln -s /Users/name/Downloads /Users/name/Desktop 
  3. Enclose the file path in quotation marks if contains spaces or other special characters.ln -s "/Users/name/My Files" "/Users/name/Desktop/My Link"
  4. To create a symbolic link in a system location, prefix the ln command with the sudo command, you need to disable SIP on modern versions of macOS: sudo ln -s /path/to/original /path/to/link

create symlink with terminal

Create symbolic links using Automator

  1. On your Mac, open the Automator application, then select New Document.
  2. Click the Choose button after selecting Quick Action in the document type box.
  3. Specify files or directories and make sure any program is chosen next to the "Workflow receives current" setting.
  4. Locate the Run Shell Script entry in the sidebar's "Actions" section, then drag it to the window's main body.
  5. The just-added action's "Pass input" setting has a list of choices next to it that you may expand and choose from. Then, type or paste the script that follows:while [ $# -ne 0 ]; do
        ln –s "$1" "$1 symlink"
        shift
    done
  6. Select File from the Automator menu bar, then click the Save link in the list. Give this quick action a name (such as "Create Symlink") and then click Save.

create symlink mac with automator

Create symbolic links via third-party apps

Either the Terminal commands or the Automator methods seem a little bit complicated. There is a relatively simple solution for you that is using a third-party application to create symbolic links on Mac. Similar to the Automator, an app like SymboLiclinker for Mac enables you to easily add an option to the context menu so that you can make symlinks by simply right-clicking on your files and folders.

symboliclinker for mac

It is pretty simple to delete symlinks on the Mac just like you delete any files on Mac. You can just right-click it in Finder/Desktop and choose Move to Trash from the context menu. Besides, you can also run the Terminal command rm /symlink location and click Enter to remove the symbolic links from Mac.

Did you double-click the symlink but it couldn't open the correct object on Mac? Have you moved the file/folder to a different location? If your answer is yes, then that is the reason. 

As stated earlier, symbolic links, unlike aliases, carry the pathname of the item rather than the inode name. The file path is altered, the symbolic link is broken, and the system is unable to locate the item if you move it to a different location. Therefore, you can create the symlink again to fix the issue.

Share this post about Symlink on Mac!

 

 

People Also Ask

Read More Questions