Permission denied @ apply2files

brew cleanup
Error: Permission denied @ apply2files - /usr/local/share/ghostscript/9.23/Resource/Font/wasy10.pfb

This error appears on every brew update, may since mactex was recently updated.

What to do?

Another tool over wrote a part of your homebrew install and set it to root permission. All you can do is set your own user to be the owner again.

Actually the Font that it complaining about is a link owned by my user account. a lot of other fonts are owned by root. The files in /usr/local/share/ghostscript/9.23/Resource/Font/ are all links to TeX fonts in /Library/TeX/Root/texmf-dist/fonts/type1/public, owned by root. It seems this is related to the update by mactex.

/usr/local/share/ghostscript/9.23/Resource/Font/wasy10.pfb points to /Library/TeX/Root/texmf-dist/fonts/type1/public/wasy2-ps/wasy10.pfb, however, the folder wasy2-ps does not exist. Instead there is wasy-type1 where the wasy fonts live.

This fixed he problem (in /Library/TeX/Root/texmf-dist/fonts/type1/public/):
sudo ln -s wasy2-ps wasy-type1

Never before did I have to resort to such a “fix”. I don’t like that.

This is the risk of mixing homebrew (ghostscript) and non-homebrew (mactex) installs. If something changes the owner to root on a homebrew directory it’ll break (since homebrew refuses to run things as root for security reasons)

I’ve just found this after having the same error.

Note that it’s not a permission error - it has nothing to do with the owner being root.

The error is because the symbolic links that homebrew is trying to delete are stale and don’t point to actual files. The fix is to create another symbolic link (yes, as root, but that’s because it’s within the TeX distribution) inside TeX to the folder that used to exist, so that homebrew can clean its link files (in /usr/local…, and still owned by the user not by root). After that, I can delete the link I created as root and everything works again.

The problem as far as I can tell is that homebrew refuses to delete its own /usr/local/… files if they are symbolic links to a file that doesn’t exist. It’s not unreasonable for TeX to shift its files around, so hence it doesn’t strike me as unreasonable that stale symbolic links might occur within a brew package?

Anyway I think that’s what the problem is - let me know if I’ve misunderstood though.

And thanks for Homebrew which is awesome and makes macOS life bearable :slight_smile:

@lyndondrake That’s an interesting take. What would you suggest to the end user doing in that case then?

I run into a similar error after installing graphviz (and I use TeXLive on the latest macOS, so maybe I’m running into the problem you described here).

Error: Permission denied @ apply2files - /usr/local/share/ghostscript/9.27/Resource/Font/wasy10.pfb

This is the risk of mixing homebrew (ghostscript) and non-homebrew (mactex) installs.

I don’t think so. Both were installed using homebrew.

Yeah, I wasn’t clear in my naming. By homebrew and non-homebrew I meant packages that are or aren’t build from source by homebrew.