kisame
kisame

Reputation: 11

how to remove symbolic link 'safely' without deleting file?

While following a tutorial online (How to Start PostgreSQL Server on Mac OS X via Homebrew) and ran the command $ ln -sfv /usr/local/opt/postgresql/*.plist ~/Library/LaunchAgents how to remove this symbolic link without causing some failure?

before command-run state

$ cd /usr/local/opt/postgresql/
$ ls
COPYRIGHT           README              include
HISTORY             bin             lib
INSTALL_RECEIPT.json        homebrew.mxcl.postgresql.plist  share

$ cd /Library/LaunchAgents 
$ ls
com.cisco.anyconnect.gui.plist      
com.cisco.anyconnect.notification.plist 
com.oracle.java.Java-Updater.plist

after command-run state

ls -l /Library/LaunchAgents 
total 16
-rw-r--r--  1 root  wheel  667 Nov 12  2020 com.cisco.anyconnect.gui.plist
-rw-r--r--  1 root  wheel  664 Nov 12  2020 com.cisco.anyconnect.notification.plist
lrwxr-xr-x  1 root  wheel  104 Jun 10 23:24 com.oracle.java.Java-Updater.plist -> /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Resources/com.oracle.java.Java-Updater.plist

Can

$ rm com.oracle.java.Java-Updater.plist

be used to remove the symbolic link and not the file itself?

Upvotes: 1

Views: 2714

Answers (1)

Laurenz Albe
Laurenz Albe

Reputation: 246298

Yes, that will remove only the symbolic link and not the underlying file. But your original ln statement can only have created a link for homebrew.mxcl.postgresql.plist, and the other links must have been created by something else, so I wouldn't remove them.

Upvotes: 1

Related Questions