How to remove a symbolic link?

I just created a symlink sudo ln -s /usr/local/mysql/lib/libmysqlclient.18.dylib /usr/lib/libmysqlclient.18.dylib and I wonder how I can get rid of it if I want. How should I do it?

+43
symlink macos
Oct 28 '11 at 17:48
source share
5 answers

Delete it like any other file: rm /usr/lib/libmysqlclient.18.dylib . rm will delete the symbolic link, not the file the link points to.

+56
Oct 28 '11 at 17:50
source share

You can also use the unlink command: unlink /path/to/sym/link

I believe that just deleting the file inside the Finder works fine and there will be a small combination on it.

+22
Jan 11 '13 at
source share

Just run:

 rm /usr/lib/libmysqlclient.18.dylib 

This will delete the file (i.e. symbolic link).

Alternatively, you can use unlink:

 unlink /usr/lib/libmysqlclient.18.dylib 
+5
Jul 15 '15 at 1:52
source share

I had a link pointing to a folder with the short name testproject: you do this with this command

 ln -s /Users/SHERIF/repo/test testproject 

I had to change the name of the folder to something else for some reason when I run the unlink command, pointing to the directory of the old folder that it did not work.

I tried only unlink testproject remove the short name in order to use the same name again and associate it with the new folder. it really worked for me.

+1
Mar 27 '17 at 8:05
source share

You can remove this link using sudo rm /usr/lib/libmysqlclient.18.dylib

0
Oct 28 '11 at 17:50
source share



All Articles