Homebrew wants me to delete /usr/local/lib?

Solution 1:

These look like most of the (recursive) dependencies of GnuPG 2.x (except those that are likely included with the OS or the development tools: zlib bzip2, perl, curl, openssl, autoconf, automake, libtool, etc.).

Here is a rough overview of the structure of those dependencies:

  • libiconv: libcharset, libiconv
  • gettext: gettext, libasprintf, libgettextlib, libgettextpo, libgettextsrc, libintl
  • gpg-agent
    • libassuan: libassuan
      • pth: libpth
      • libgpg-error: libgpg-error
    • libksba: libksba
    • libgcrypt: libgcrypt
  • libusb-compat: libusb (0.1.4)
    • libusb: libusb (1.0.0)

I wonder if maybe they are from installable packages of the macgpg2 project (it even includes a charset.alias its iconv package).

Besides /usr/local, these packages also write to these locations:

  • /Applications/start-gpg-agent.app/
  • /Library/LaunchAgents/com.sourceforge.macgpg2.gpg-agent.plist
  • /private/etc/paths.d/MacGPG2

Note: I only scanned through the Info.plist files and the BOMs from the packages, there may be other files elsewhere. Pacifist might be useful if you want to try to go through your /Library/Receipts/ entries to try to find all the files it might have installed.


If these all came from some installation of GnuPG, and you no longer need it (Homebrew only seems to have GnuPG 1.x, otherwise you could rebuild it yourself), then it is probably safe to delete the files. Though I would start /usr/local/ from scratch instead of just clearing lib and include (probably by mv /usr/local /usr/local.old like geekosaur mentioned).

Solution 2:

That's kinda the problem; Homebrew doesn't know what they are either, and randomly sourced libraries tend to break builds. (MacPorts makes the same recommendation. In fact, I was under the impression that was one of the things Homebrew relaxed.)

If you don't know what they are or if they're used, the simplest solution is

$ sudo mv /usr/local /usr/local.keep

and watch to see what breaks. Chances are they're used by whatever's in /usr/local/bin, though, so look there first.