Getting started with homebrew – Installation

Homebrew can be installed using the following command in the terminal:

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

It runs as the current user; you don’t need to use sudo. The script can be viewed online and will print a summary of what it’ll do before actually doing it.

You then have to add /usr/local/bin to your PATH if it’s not already there. Run the following command to check:

echo $PATH

If you don’t see /usr/local/bin in the output you’ll have to add it. Open your ~/.bash_profile file in an editor and add the following lines at the end:

# Add Homebrew prefix to the PATH
export PATH="/usr/local/bin:$PATH"

Now run source ~/.bash_profile. The brew command should now be available:

brew help

if you want to reproduce, please indicate the source:
Getting started with homebrew – Installation - CodeDay