Installing Homebrew on macOS Monterey 12, Package Manager for Linux Apps

The easiest way to install a number of Unix style applications and open source software onto macOS Monterey, Big Sur, Catalina, Mojave and earlier Sierra OS versions is via a package manager, unfortunately, macOS Monterey doesn’t come with one, but fortunately, some good folks care, they come in the form of Homebrew.

The install of Homebrew also works on macos Big Sur, macOS Catalina, macOS Mojave, (High)Sierra, El Capitan, and Yosemite, so macOS 10.10 – 12

Homebrew isn’t the only option, also available is MacPorts and Fink but Homebrew is the latest and most popular of the trio.

Home Brew Osx Lion Package Manager

Install Homebrew on macOS

To download install Homebrew run the install script on the command line as below and let the script do its thing:

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

If you don’t have Apples Xcode Command Line Tools installed it will alert you and you need to hit enter/return on the command line to install the Xcode Command Line tool and carry on with the Homebrew installation you will also need to enter your admin password a couple of times in the process.

==> Checking for `sudo` access (which may request your password).
Password:
==> This script will install:
/usr/local/bin/brew
/usr/local/share/doc/homebrew
/usr/local/share/man/man1/brew.1
/usr/local/share/zsh/site-functions/_brew
/usr/local/etc/bash_completion.d/brew
/usr/local/Homebrew
==> The following new directories will be created:
/usr/local/bin
/usr/local/etc
/usr/local/include
/usr/local/lib
/usr/local/sbin
/usr/local/share
/usr/local/var
/usr/local/opt
/usr/local/share/zsh
/usr/local/share/zsh/site-functions
/usr/local/var/homebrew
/usr/local/var/homebrew/linked
/usr/local/Cellar
/usr/local/Caskroom
/usr/local/Frameworks
==> The Xcode Command Line Tools will be installed.

From https://github.com/Homebrew/homebrew-core
 * [new branch]              master     -> origin/master
Updating files: 100% (6206/6206), done.
HEAD is now at b4a4beeca8d bde: update 3.61.0.0 bottle.
==> Installation successful!

==> Homebrew has enabled anonymous aggregate formulae and cask analytics.
Read the analytics documentation (and how to opt-out) here:
  https://docs.brew.sh/Analytics
No analytics data has been sent yet (or will be during this `install` run).

==> Homebrew is run entirely by unpaid volunteers. Please consider donating:
  https://github.com/Homebrew/brew#donations

==> Next steps:
- Run `brew help` to get started
- Further documentation: 
    https://docs.brew.sh

Then Homebrew is installed.

After this Homebrew is installed and ready to install other apps.

To get started run brew help can give some command example usage.

brew help

To check for any issues with the Homebrew install run:

brew doctor

One issue that typically comes up is an outdated or missing version of Xcode.

For the latest macOS, brew doctor will warn that the Homebrew install won’t be 100% if Xcode is not up to date, so update Xcode from the App Store.

To search for an application:

brew search

To install

brew install packagename

To list all apps installed by Homebrew

brew list

To remove an installed application

brew remove packagename

To update Homebrew itself

brew update

To see what packages are out of date but not to upgrade them

brew outdated

To see what upgrade packages all or singular

brew update

brew update packagename

To hold a package at a certain version

brew pin packagename

To release a package from a certain version

brew unpin packagename

To see what else you can do

man brew

Where does Homebrew install stuff …. ?, well it depends on whether you Mac has an Intel chip or an Apple chip

Intel Chip – Homebrew location

/usr/local/

Apple Chip – Homebrew location

/opt/homebrew/

Where the brew lives.

You can see your Homebrew configuration by running

brew config

The output should be similar to …

[email protected] users % brew config
HOMEBREW_VERSION: 3.3.2
ORIGIN: https://github.com/Homebrew/brew
HEAD: 9daf5e2d28396c7a4379605e89e029d9fccb41e6
Last commit: 7 days ago
Core tap ORIGIN: https://github.com/Homebrew/homebrew-core
Core tap HEAD: b4a4beeca8d3b4c30906b1016bd344961403978c
Core tap last commit: 68 minutes ago
Core tap branch: master
HOMEBREW_PREFIX: /usr/local
HOMEBREW_CASK_OPTS: []
HOMEBREW_CORE_GIT_REMOTE: https://github.com/Homebrew/homebrew-core
HOMEBREW_MAKE_JOBS: 4
Homebrew Ruby: 2.6.8 => /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby
CPU: quad-core 64-bit skylake
Clang: 13.0.0 build 1300
Git: 2.30.1 => /Library/Developer/CommandLineTools/usr/bin/git
Curl: 7.77.0 => /usr/bin/curl
macOS: 12.0.1-x86_64
CLT: 13.1.0.0.1.1633545042

All installations via Homebrew are filed independently in the filing system in /usr/local/Cellar and linked into /usr/local/bin which is a directory which allows you to run these commands and apps as if part of the regular operating system.

This directory is also out of the SIP bounds so there should be no authentication macOS error dialog boxes.

Remove Home-brew and all packages

To remove the Home-brew installation and all packages it has installed..

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

HomeBrew is a great package manager just start installing some apps and explore.!

Homebrew 256x256

3 Comments

  1. Lee Saloutos on December 18, 2021 at 10:03 pm

    When running this command [on an M1 MBP with MacOS 12]:

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

    I get the following:

    Press RETURN to continue or any other key to abort:
    ==> /usr/bin/sudo /usr/sbin/chown -R lee:admin /opt/homebrew
    ==> Downloading and installing Homebrew…
    xcrun: error: unable to load libxcrun (dlopen(/Applications/Xcode.app/Contents/Developer/usr/lib/libxcrun.dylib, 0x0005): tried: ‘/Applications/Xcode.app/Contents/Developer/usr/lib/libxcrun.dylib’ (mach-o file, but is an incompatible architecture (have ‘x86_64’, need ‘arm64e’)), ‘/usr/lib/libxcrun.dylib’ (no such file)).
    Failed during: git init -q

    It appears xcrun is looking for an Intel executable and not an ARM executable. What am I doing wrong? My end goal is installing PHP, which has been removed.

  2. Alex on November 4, 2021 at 2:16 pm

    Hi,
    trying the install script provided I receive : curl: (7) Failed to connect to raw.githubusercontent.com port 443: Bad file descriptor

    Any idea? Thanks

  3. keith cooper on April 17, 2021 at 9:50 pm

    The Apache site does not include binaries for macOS 11. You need to use a package manager such as brew

Leave all Comment