Install Homebrew in macOS
Strangely I’ve struggled a bit to install Homebrew package manager in my mac. I’d done this in the past a couple of times, but now it felt tricky. Anyway, it’s simple. All you need to do is to install Homebrew through command line or .pkg file (download here).
For command line way, copy the code below and paste it in the command line and hit enter.
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
It should probably start downloading now and take a while before its done.
OK, ideally right after the above steps are taken, you should be able to get on with it and use ‘brew’ command to your will. But no, macOS doesn’t add the new path of the ‘brew bin’ to existing system path. Let’s do that now.
We have to add the path /opt/homebrew/bin to the current path. You can check the current path by hitting the following command..
echo $PATH
Copy pasta (pun) the following snippet which essentially is going to add the required path to the, well, ‘the PATH’.
export PATH=$PATH:/opt/homebrew/bin
After that, check the PATH variable again and make sure the Homebrew path is added.
That’s it. To satisfy your inner engineer and test if it’s done, just close all terminals and open a fresh one and see if brew is installed. Just deploy <brew help>!!
If you somehow got lost or f***ed up so bad that you still see the error “bash command not found”, then time for a redo of everything from step 1. Good luck and cheers! 🍻