Homebrew setup on macOS

Homebrew is a package manager for macOS that allows you to easily install third-party software and keep it up-to-date. If you have ever used Ubuntu, then Homebrew is much like aptitude (apt).

To install Homebrew, open the Terminal and copy & paste the following command:

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

Homebrew installs all executable programmes in /opt/homebrew/bin and this path is not in the default executable path of macOS. To add the path for your user, you have to edit the file ~/.zprofile. The brew installation provides you two lines of Terminal commands to achieve this:

echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.zprofile
eval "$(/opt/homebrew/bin/brew shellenv)"

This will add /opt/homebrew/bin to your user’s PATH variable. You may also consider to add that path to the default environment.

To maintain Homebrew (update the list of available programmes and their versions and update the installed programmes) you may want to place a new script called brew-maintain.sh under /usr/local/bin with the following contents:


brew update;
brew cleanup;
brew upgrade;
brew cleanup;

Once the script is place there, you can call it from the Terminal to maintain Homebrew at any time.

Turn off analytics

To turn off analytics (sending anonymous data) type the following command in your Terminal:

$ brew analytics off

Leave a comment

Your email address will not be published.