In this article we will look at some commands are used in the terminal to work with symbolic links.

Symbolic link is a special file in the file system, which instead of user data contains the path to the file opened when the link file is accessed.

The target of the link can be any object. For example:

  • Another link;
  • File;
  • Directory;
  • Or even a non-existent file.

Symbolic links are used to more conveniently organise the structure of files on a computer, since:

  • allow for a single file or directory to have several names and different attributes;
  • free from some of the limitations inherent in hard links (the latter are valid only within one file system (one partition) and cannot refer to directories).

The Finder does not know about symbolic links, so it just sees that it looks like a directory and proceeds to walk the directory tree looking for all the files it needs to delete before it can delete the top item (your symlink).

So we need other tools to interact with symbolic links in macOS.

macOS & Bash Command Line

Create Symbolic Link

  • If you want to create the symbolic link, just type the following commands in Terminal:
ln -s /path/to/destination /path/to/your/symbolic/link

(example: ln -s /tmp/symlinksource /tmp/osxtips )
  • Next move to see link:
ls -l /path/to/your/symbolic/link
(example: ls -l /tmp/osxtips )
  • Output must be something like that:
lrwxrwxrwx 1 user group 19 Feb 4 14:47 /tmp/osxtips -> /tmp/symbolicsource
  • If access control list string (lrwxrwxrwx) starts with “l” it means before us a symbolic link file.

Unlink Symbolic Link

  • Also you can use “unlink” command to remove directory entries including in symbolic links:
unlink /path/to/your/symbolic/link

(example: unlink /tmp/osxtips)

Remove Symbolic Link

  • If you want to remove symbolic link called /tmp/osxtips, input next command and press “Enter”:
rm /path/to/your/symbolic/link

(example: rm /tmp/osxtips )
  • In order to make sure that the link is deleted:
ls -l /path/to/your/symbolic/link

(example: ls -l /tmp/osxtips )
  • Caution: The “rm” command removed the symlink file /tmp/osxtips, but not the file the link is pointing to /tmp/symbolicsource .


If the symbolic link is in a privileged directory and system blocked your request for deleting, just try again with “sudo”.

Caution: Be very carefully using “sudo”, it means you have a “root” privileges for a short time.

  • Type this command in Terminal:
sudo rm /path/to/your/symbolic/link

(example: sudo rm /etc/osxtips )
  • Now type your admin password and your symbolic link will be deleted.

And the last

If you have some troubles with syntax or commands failed, you can open more intensive system manual about symbolic links.

  • Just input this command in Terminal:
man ln

Just keep in mind, that you can use all of this commands in macOS, Linux, or any other modern Unix based operating system by the methods ahead.

It’s the best time to ask questions and give us your feedback in comments.


Hi there! My Name is Vincent Lago! My goal is to share insightful reviews, guides, and manuals for people looking to know more about current solutions for Apple hardware and OS. I have years of technological background knowledge including owning a custom iMacs & PCs which was using for different types of business. And now, I want to share my experience with you.

Write A Comment