2

When I run brew doctor, I get this warning:

Warning: Unbrewed dylibs were found in /usr/local/lib.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.

Unexpected dylibs:
    /usr/local/lib/libusb-0.1.4.4.4.dylib
    /usr/local/lib/libusbpp-0.1.4.4.4.dylib

According to this question and answer, I want to delete these files.

But when I remove the second one with rm, it seems to be recreated automatically:

$ rm /usr/local/lib/libusbpp-0.1.4.4.4.dylib
override rwxr-xr-x  root/wheel for /usr/local/lib/libusbpp-0.1.4.4.4.dylib? 
$ ls /usr/local/lib/libusbpp-0.1.4.4.4.dylib
/usr/local/lib/libusbpp-0.1.4.4.4.dylib

I totally don't understand what's going on. Why can't I delete this file?

ironsand
  • 2,299

3 Answers3

5

rm is telling you that you don't have write access to the file you told it to delete, and is asking for confirmation. Type y and then press return when it asks you if you want to override. If you type n or nothing at all, it won't delete the file.


Technical(ish) details:

rwxr-xr-x root/wheel is a representation of the permissions and ownership of the file.

The first part tells you the permissions of the file; the second that the file is owned by the user root and the group wheel.

See man chown for more information on file ownership, and man chmod for more information on file permissions. Wikipedia might have easier-to-understand information on chown and chmod.

1

The answer above is accurate for the contents of /usr/local/. MacOS has something called System Integrity Protection, which restricts the actions of superuser. Attempts to alter the contents of /usr/bin and other folders may be rejected with Operation not permitted. This is described in which folders are affected by System Integrity Protection.

John
  • 111
  • THANK YOU! Among the many answers I've read about this issue, this is the first one I've seen that mentions MacOS's System Integrity Protection, which indeed was what was causing my problem. – Asker Apr 29 '23 at 09:44
1

You need to use sudo...

sudo rm -rf /usr/local/lib/libusbpp-0.1.4.4.4.dylib

that should do it

djabou136
  • 11
  • 2