Skip to content

Instantly share code, notes, and snippets.

@d6u
Created October 24, 2021 23:34
Show Gist options
  • Select an option

  • Save d6u/b3cef41957e16db45fb0c930436a778e to your computer and use it in GitHub Desktop.

Select an option

Save d6u/b3cef41957e16db45fb0c930436a778e to your computer and use it in GitHub Desktop.

Homebrew on Mac

A cleaner solution is to install homebrew into a custom location in a user's folder - use ~/homebrew/. Don't touch /opt/homebrew folder

Configure homebrew for use with a local folder. Here's how you can do it:

  1. Clone homebrew to a local directory, e.g., if you want to have it in ~/homebrew, run the command git clone https://github.com/Homebrew/brew ~/homebrew
  2. Add brew binary folders to the PATH environmental variable: echo 'export PATH="$HOME/homebrew/bin:$HOME/homebrew/sbin:$PATH"' >> ~/.bash_profile, then source ~/.bash_profile
  3. Run brew update; then use brew as you normally would, e.g. brew install octave

Putting brew into a user-owned folder is a clean solution but it is also not without peril - homebrew will be compiling all packages from source code, leading to longer install times.

Finally, when browsing your filesystem, you might notice that there is a folder in /opt/homebrew, yet there is no brew executable anywhere near it. This folder is created by yum package manager and should not be touched.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment