Getting Homebrew

What’s Homebrew

A package manager for macOS, allowing users to easily install, update, and manage software packages. Basically, it simplifies the process of installing command-line tools, libraries, and applications by handling dependencies, versioning, and updates. As per their website, Homebrew installs the stuff you need that Apple (or your Linux system) didn’t.

I remembered a great post I recently read on reddit while researching the sw, lemme grab it for you:

Comment
byu/AnshM from discussion
inMacOS

Install

Get Homebrew from github, simply paste the following on to your terminal:

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

This will download the necessary software and create the required directories to run homebrew.

Once done, you should see the installation was successful.

If you installed it for the first time, you should be instructed to add the environment variable to your PATH. It’s best to copy&paste, hence you could easily replace your profile if you miss a > in the first command.

OK, but what the heck are those commands?

Firstly,

(echo; echo 'eval "$(/opt/homebrew/bin/brew shellenv)"') >> /Users/nikolettahaverova/.zprofile
  • This command appends the output of the inner command to the file at the given route and it’s purpose is to add a line to the .zprofile file so that when the user logs in, the eval command will be executed, setting up Homebrew environment variables.

Next, this guy:

eval "$(/opt/homebrew/bin/brew shellenv)"
  • Evaluates the output of the command /opt/homebrew/bin/brew shellenv.
  • The brew shellenv command outputs shell-specific environment variable settings that are needed to configure the shell environment for Homebrew, while the eval command is used to execute these settings in the current shell session. At least, that’s what ChatGPT said.

TLDR; the two commands together are configuring the user’s shell environment to include Homebrew settings. The first command modifies the .zprofile file to include the necessary setup, and the second command immediately applies those settings to the current shell session.

Verify the installation by checking it’s version.