How to install Homebrew on macOS – Full guide (2021)

Published June 15, 2021; last updated on September 10, 2021
How to install Homebrew on macOS – Full guide (2021)

Homebrew is a great way to manage packages on macOS. Arguably it is one of the best package managers out there, because it’s simple to use and offers thousands – if not more – packages with just a few simple commands. In this guide I’ll show you how to install Homebrew on macOS, so that you can get up and running immediately.

Homebrew is an app that works via the terminal. That means that there isn’t a native ‘regular’ UI like you would expect (checkout Cakebrew if you do need one). Installing Homebrew can be daunting if you do it for the first time, but, in fact, it’s nothing more than running a few commands in the right order.

Installing Xcode command line tools

In order to install Homebrew, you need the Xcode command line tools installed. If you’ve never made use of the terminal yet on your Mac, chances are that this need to be installed. Paste the following command in the terminal to install them:

xcode-select --install

If the command line tools are not yet installed, a popup will appear, asking you for permission to install the tools. Click Install and wait till the installation is finished.

If the tools are already installed, the terminal will display a message that it is already installed and that updates come the Software Updates.

Install Homebrew on MacOS

To install Homebrew, open up the terminal and paste the following command:

/bin/bash -c "$(curl -fsSL"

This command will start the installation for you. Enter your password to start the process (if asked). The installation will continue automatically. The installation is successful if you see something like this:

 * [new branch]            master     -> origin/master
HEAD is now at 7fb6354a2a pandoc-crossref: update bottle.
Warning: /opt/homebrew/bin is not in your PATH.
==> Installation successful!

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

==> Homebrew is run entirely by unpaid volunteers. Please consider donating:

==> Next steps:
- Add Homebrew to your PATH in /Users/ralphjsmit/.zprofile:
    echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> /Users/ralphjsmit/.zprofile
    eval "$(/opt/homebrew/bin/brew shellenv)"
- Run `brew help` to get started
- Further documentation:

Final steps: put /opt/homebrew/bin in your $PATH

After Homebrew is installed, you’ll still need to take a few final steps. The first step is to put a specific path in your $PATH. You do not need to know why this is, but Homebrew will provide you with two commands that will do the trick:

==> Next steps:
- Add Homebrew to your PATH in /Users/ralphjsmit/.zprofile:
    echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> /Users/ralphjsmit/.zprofile
    eval "$(/opt/homebrew/bin/brew shellenv)"

Copy the two commands from your terminal (they’re a slightly different for each computer), paste them and hit enter. Note that the first command starts with echo... up to .../.zprofile and the second is eval " ... shellenv)".

Disabling analytics (optional)

The last step I usually take is disabling analytics. Homebrew uses Google Analytics to send ‘anonymous aggregate user behaviour analytics’ to them. This allows them to prioritize bugfixes and check which OS version people are using (useful for development).

You’re free to enable or disable Homebrew analytics. It will not impact your experience. Opting out (forever) can be done by running:

brew analytics off
Stay up to date with all things Laravel, Tailwind, WordPress & PHP

Subscribe now to my e-mail newsletter and get my latest articles and project updates delivered directly to your inbox. Never miss an update.

Image Ralph J. Smit
Ralph is a designer gone developer. He happily lives in the Netherlands. His passion for good design drove him towards development, because he felt that no-code tools were too limiting. On this blog, Ralph writes the articles he would've wanted to have during his continual developer journey. → Follow on Twitter


  • daniel

    January 4, 2022

    I am getting a issue with mine every time i am running brew doctor. Warning: Homebrew/homebrew-core was not tapped properly! Run: rm -rf "/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core" brew tap homebrew/core Why is this happening?

    • Ralph Smit

      January 5, 2022

      Hey Daniel, as far as I know, that message is primarily for Homebrew maintainers to help with debugging. If everything else works fine you can just ignore it. You can also try to run those two commands (the "rm -rf ..." and "brew tap ...") and see if that hides the issue for you.

  • Scott

    November 29, 2021

    I'm getting this error on my MacBook Pro M1 when installing brew and trying to update it as well. How do I move my HOMEBREW_CELLAR? Thanks! scott@ScottsMacBook14M1 bin % brew update Warning: your HOMEBREW_PREFIX is set to /usr/local but HOMEBREW_CELLAR is set to /opt/homebrew/Cellar. Your current HOMEBREW_CELLAR location will stop you being able to use all the binary packages (bottles) Homebrew provides. We recommend you move your HOMEBREW_CELLAR to /usr/local/Cellar which will get you access to all bottles."

    • Ralph Smit

      November 29, 2021

      Hey Scott, looks like Homebrew was installed with the location `/usr/local`, but on an M1-Mac it is looking for the `/opt/homebrew/` location. (The `/usr/local` is the location on Intel Macs. Judging by this StackOverflow answer and other sources, the best you can do is to uninstall Homebrew and try to install it again. Sorry!🥺

  • Siddhanth

    November 21, 2021

    Hi, I tried entering these two commands on the mac terminal, but it did not show any response. echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> /Users/siddhanth/.zprofile eval "$(/opt/homebrew/bin/brew shellenv)" How can I proceed with the next steps stage?

    • Ralph Smit

      November 26, 2021

      Hey there, those steps do not necessarily give any output. You can check if Homebrew is installed correctly by running "brew -v". If that produces any output that looks like this: Homebrew 3.3.5 Homebrew/homebrew-core (git revision 00f3d1617a5; last commit 2021-11-25) Homebrew/homebrew-cask (git revision 026160a691; last commit 2021-11-25) Then you're good to go!

  • Benjamin

    November 18, 2021

    Hello Ralph, Although it says the installation was successful, I have not received the two commands to install my path in the "next steps" paragraph. Could you help me to get this fixed? Thanks!

    • Ralph Smit

      November 19, 2021

      Hey Benjamin, Hmm, weird that you do not get that command anymore. It could be that Homebrew changed the installation process or something else happened. Could you try running the command "brew -v" and check if that works?

      • Benjamin

        November 19, 2021

        hey Ralph, thanks but it didnt work! I got this : Last login: Thu Nov 18 21:40:22 on ttys000 benjamin@Benjamins-MacBook-Air ~ % brew -v Homebrew 3.3.4 Homebrew/homebrew-core (git revision feddfd3b28b; last commit 2021-11-18) benjamin@Benjamins-MacBook-Air ~ %

        • Ralph Smit

          November 20, 2021

          Hey Benjamin, that looks like Brew was installed correctly! The last two commands to the path are to make sure that you can run 'brew [command]' from the terminal and not get an error. In your output it works correctly, because it returns the latest version of Brew. So I think that you should be able to start with Brew!

  • Leandro from Argentina

    November 6, 2021


  • Alex

    October 19, 2021

    Thank you!

  • Timi

    October 10, 2021

    I received an xcrun: error unable to load libxcrun I am a novice just trying to install gitbash for my training. Could you please help.

    • Ralph Smit

      October 11, 2021

      Hey Timi, that looks like Git isn't installed on your computer yet. On a Mac, Git is installed by default, but you need to accept the Xcode license first before you can use it. Could you try running "xcode-select --install" and following the prompts to active your license?

  • Steve

    September 25, 2021

    Hi, Does the following mean homebrew is in my PATH? I just want to make sure I did everything correctly when I installed homebrew. stevegrant@Steves-Air ~ % which brew /opt/homebrew/bin/brew Thanks, Steve

Leave a reply

Leave a Reply to Leandro from Argentina Cancel reply

Your email address will not be published. Required fields are marked *

Do you want more articles like this delivered straight to your inbox?

Subscribe now to my e-mail newsletter and get my latest articles and project updates delivered directly to your inbox. Never miss an update.