I'm wondering if it is possible (and if so, how) to install Homebrew package manager to /usr
directory rather than /usr/local
directory. I have macOS High Sierra.
MacOS – How to install homebrew to /usr rather than /usr/local
high sierrahomebrewmacos
Related Question
- MacOS – Homebrew and existent software in /usr/local
- MacOS – How to figure out what is causing the ownership of /usr/local to change from the-username to root
- MacOS – How to install a Homebrew recipe maintained in a separate git repository outside of /usr/local/Library/Formula
- How to install local .dmg files via homebrew
- MacOS – Does homebrew usually put lots of files in the /usr/local folder itself
- How to install composer via homebrew
- Change permisions on /usr and /usr/local to link Homebrew package
- What’s the right ownership for /usr/local for current macOS and Homebrew versions
Best Answer
One way is to modify the
install.sh
script in homebrew git source and changeHOMEBREW_PREFIX
to point to whereever you want homebrew to install.In my case, I've decided to use
/usr/local2
, because of some restrictions on/usr/local
in OSX Catalina, so modifyinstall.sh
withHOMEBREW_PREFIX=/usr/local2
andHOMEBREW_REPOSITORY=/usr/local2/Homebrew
before running./install.sh
.Two problems you have to watch:
/usr/local
unless you manually hunt down and modify the source (not trivial)/usr
, where a lot of system commands exist there, which you never want to replace at all.