3

I am running macOS Monterey, 12.2.1 on my Mac. I had installed Homebrew a couple of years ago and had not updated it in the past few months. Now as I tried to run brew doctoror brew cleanup or brew update I came across various errors of permission being denied (like Error: Permission denied @ apply2files while trying brew cleanup). So, I decided to uninstall Homebrew with a plan to reinstall it later. I ran:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/uninstall.sh)"

At the end of the uninstallation, I was told:

==> Homebrew uninstalled!
The following possible Homebrew files were not deleted:
/usr/local/.com.apple.installer.keep
/usr/local/Frameworks/
/usr/local/Homebrew/
/usr/local/bin/
/usr/local/etc/
/usr/local/gfortran/
/usr/local/include/
/usr/local/lib/
/usr/local/opt/
/usr/local/remotedesktop/
/usr/local/sbin/
/usr/local/share/
/usr/local/texlive/
/usr/local/var/
You may wish to remove them yourself.

A bit absentmindedly I ran sudo rm -rf /usr/local/.com.apple.installer.keep and the same for /usr/local/Frameworks/ and /usr/local/Homebrew/. Then I noticed what I was doing and stopped short of deleting /usr/local/bin. My /usr/local/bin contains

dvipdf          gslp            ps2pdf13
eps2eps         gsnd            ps2pdf14
font2c          lprsetup.sh     ps2pdfwr
gfortran        pdf2dsc         ps2ps
gs          pdf2ps          ps2ps2
gs-X11          pf2afm          sage
gs-X11-Yosemite     pfbtopfa        texdist
gs-noX11        pphs            texdistmgr
gs-noX11-Yosemite   printafm        unix-lpr.sh
gsbj            ps2ascii        wftopfa
gsdj            ps2epsi
gsdj500         ps2pdf

Why would Homebrew want me to delete them? What will happen to the directories I have already deleted in /usr/local/? Thank you!

2 Answers 2

2

Homebrew did not delete these directories because they may contain files not installed via Homebrew.

In your case, the listed binaries seem to be related to your TexLive installation. I assume you want to keep them.

The removal of /usr/local/{Frameworks,Homebrew} shouldn't have an impact, I would leave the other directories as they are though.

PS: Not sure what the purpose of .com.apple.installer.keep is, it is an empty file which seems to be installed as part of macOS. If you want to recreate it, run

sudo touch /usr/local/.com.apple.installer.keep
sudo chown root:wheel /usr/local/.com.apple.installer.keep
2
  • Thank you! Yes, I do want to keep files related to my TexLive distribution. What does the /usr/local/Frameworks and /usr/local/.com.apple.installer.keep usually contain?
    – damaihati
    Commented Mar 4, 2022 at 6:55
  • 1
    @damaihati Frameworks is part of the Homebrew installation, .com.apple.installer.keep is an empty file which seems to be created when you install macOS.
    – nohillside
    Commented Mar 4, 2022 at 7:05
3

First note that Apple does not put anything under /usr/local so that removing things will not break the OS. This also means that you or other admins of the machine have made decisions to put stuff in it.

Homebrew (on Intel and PPC) installs into various directories under /usr/local

The problem is that other installs go into /usr/local as well as per Unix norms.

Thus I think you have other things installed by actions other than Homebrew into /usr/local and this confuses Homebrew which assumes that everything under /usr/local is under its control. Thus you get the failure of brew doctor. However the /usr/local/bin directory might well just be executables installed by Homebrew

So you have to decide what you installed and why.

This can be complex.

In this case I would delete all under /usr/local and then reinstall what you need. This might just be reinstall Homebrew. (I would note other package managers don't use /usr/local and so can coexist with manual Unix installs for things not available in that package manager)

2
  • This explains why Homebrew suggested I should delete those directories. I would not delete everything under /usr/local as they contain files related to my TexLive installation, as noted by @nohillside.
    – damaihati
    Commented Mar 4, 2022 at 6:53
  • Yes but you then have the problem that some of those directories are not TeXLive but are Homebrew e.g. //usr/local/Homebrew/ and I expect things like gfortran
    – mmmmmm
    Commented Mar 4, 2022 at 7:31

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .