5: Installing Homebrew

Photo by Elevate on Unsplash

5: Installing Homebrew

Day 3: Installing important tools

First up, I love the name. So, easy to remember.

Secondly, I love their logo!

Is that beer with an apple? Strange drink.

Thirdly, I like their domain extension https://brew.sh/. I didn't know there was a ".sh" domain name out there.

What is Homebrew?

Their website says:

Homebrew installs the stuff you need that Apple (or your Linux system) didn’t.

I still don't understand. What does it do?

Here are a few definitions that helped me understand just slightly better:

  • Homebrew is a package manager to manage the complexities of all the software installations.

  • Homebrew is a free and open-source software package management system that simplifies the installation of software on Apple's operating system, macOS, as well as Linux. The name is intended to suggest the idea of building software on the Mac depending on the user's taste. (Wikipedia)

  • Homebrew is for any apps; it's an app manager for OS X so you don't have to compile things manually. There are a ton of tools for the command line that aren't covered by npm . I strongly recommend homebrew - the Apple stuff is quite out-of-date ( git , sed , awk , bash ) and homebrew keeps you up-to-date. (Stack Exchange).

  • Homebrew is package manager for Macs which makes installing lots of different software like Git, Ruby, and Node simpler. Homebrew lets you avoid possible security problems associated with using the sudo command to install software like Node (Git Hub).

In summary, I think Homebrew helps install software easily.

OK, let's install this thing!

The first step is checking if cURL was installed when xcode was installed.

What is cURL?

Pronounced "curl", Apple defines it as - Specifies a Uniform Resource Locator (URL) or Uniform Resource ID (URI)

A Hubspot article describes it a little bit more:

Client URL (cURL) lets you exchange data between your device and a server through a command-line interface (CLI).

  1. Go to Terminal and type:

    which curl

  2. You get this response:
    /usr/bin/curl

My course notes also show the above response, so I assume there is a cURL.

  1. Typed this into the Terminal:

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

  1. Terminal spits out this message:

==> Checking for sudo access (which may request your password)...

Password:

I was worried. Anytime, anything asks me for a password, I am concerned. But risks must be taken. When I type in the password, it doesn't actually show up on screen nor does the cursor move. That was nice.

  1. Once the password is entered, you get the below output:
==> This script will install:
/opt/homebrew/bin/brew
/opt/homebrew/share/doc/homebrew
/opt/homebrew/share/man/man1/brew.1
/opt/homebrew/share/zsh/site-functions/_brew
/opt/homebrew/etc/bash_completion.d/brew
/opt/homebrew
==> The following new directories will be created:
/opt/homebrew/bin
/opt/homebrew/etc
/opt/homebrew/include
/opt/homebrew/lib
/opt/homebrew/sbin
/opt/homebrew/share
/opt/homebrew/var
/opt/homebrew/opt
/opt/homebrew/share/zsh
/opt/homebrew/share/zsh/site-functions
/opt/homebrew/var/homebrew
/opt/homebrew/var/homebrew/linked
/opt/homebrew/Cellar
/opt/homebrew/Caskroom
/opt/homebrew/Frameworks

Press RETURN/ENTER to continue or any other key to abort:
  1. Press the ENTER key to continue

  2. Then, a whole lot of lines appear on the screen. No idea what they mean but the whole thing is finished, it showed 3 main alerts:

    1. Warning: /opt/homebrew/bin is not in your PATH.

    2. \==> Installation successful!

    3. \==> Homebrew has enabled anonymous aggregate formulae and cask analytics.

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

    5. \==> Next steps:

  3. My course notes asked me to run the following command:

    brew help

But I got this error:
command not found! brew

Panic time!

  1. So, I contacted my tutors on Discord and they jumped into action asking me to run the next steps as outlined in the "Warning" message above.
    (echo; echo 'eval "$(/opt/homebrew/bin/brew shellenv)"') >> /Users/abc/.zprofile eval "$(/opt/homebrew/bin/brew shellenv)"

  2. A whole of things happened on screen and then I ran:
    brew help

  3. A whole of things happened again and then I ran this command:

    brew install tldr

Why is tldr installed?

This command installs a short manual or documentation so that you can learn more about certain commands you want to know more about. E.g: If you want to know more about the cd (change directory) command, you would type tldr cd into the Terminal and it writes back with a small definition of it.

Note: It's not exactly the same as the man command (man cd) which pulls out a much more detailed documentation of a command.

TLDR: stands for "to long, didn't read".

Conclusion:

Installations went well. For some reason, once the above command line finished its execution, my monitors shut down, and the browsers too! I informed the tutor and she said it's not a command line issue. I think my new computer has some hardware issues. I hope not.


See you in the next post for installing VSCode.