This Instructable is going to be used in a couple of other documents and so I decided to separate it out in order to prevent doubling up in the other Instructables I will be writing.
This Instructable will guide you through the process for install HomeBrew which will allow a number of UNIX applications to be installed on macOS.
Step 1: Install Xcode
The whole process is reliant on Xcode being installed but good news is it doesn't need the full version of Xcode to be installed.
However, for sake of simplicity I'm going to recommend downloading the full version of Xcode from the Mac App Store as this will install a number of powerful development tools for macOS while also installing the command line tools needed for Home Brew.
Once downloaded run the app and accept the dialog boxes that come up. This should include installing the command line tools.
Step 2: Run Terminal
I'm using macOS Sierra so to run Terminal I simply click the Rocketship in the Dock then in the Launchpad window I click Other then locate and click on Terminal.
Step 3: Installing Brew
Copy and paste the below code into the Terminal window:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
This will download and install HomeBrew from the command line.
Step 4: Press Return
You will be greeted with a screen that tells you what is going to happen.
Simply follow the prompt to press the RETURN key
Step 5: Enter Your Password
When you installed your machine it would have asked you to create a username and password.
The password you need to enter is this one and only this one.
When entering the password you will not see any indicators as to what the password is so make sure you get it right.
Press RETURN key once you've typed the password.
Step 6: Just Let It Run
This process will take some time and there's NOTHING you can do so walk away and grab a cup of coffee (or tea if you're as sophisticated as me ;-) ).
Step 7: Finished - Sort Of
The install is finished but not completed.
There's a couple of options that need to happen.
Step 8: Add the Path to Your Terminal Profile
Many UNIX commands installed outside of macOS can't be found and you'll get errors about commands not being found. This is an easy fix by simply adding a path. The beauty of HomeBrew is that it uses a generally uniform path for everything so it will still need to be added to your Terminal profile.
Simply copy and paste this command to the Terminal and press RETURN:
echo export PATH='/usr/local/bin:$PATH' >> ~/.bash_profile
This will create a text file that Terminal reads. As Terminal is running already it won't reread this file so simply press Command W then press Command N.
This will close the existing window then open a new one.
DO NOT PRESS Command Q as this will close the application. If you do do this simply rerun Terminal.
Step 9: Call the Doctor
Now that HomeBrew has been installed and Terminal has the correct path settings you need to make sure HomeBrew is good to go.
The simple check is as follows:
Step 10: Ready to Brew
If there are no issues you should see the message
Your system is ready to brew
Step 11: Update Brew
Even though you've just installed HomeBrew there could be updated files during the process so type:
Step 12: All Good
If it's all good then there is one last command
Step 13: Upgrades Are Not the Same As Updates
This installs later major versions of software not updates within the current version. Think of it as installing macOS Sierra from macOS El Capitan instead of installing macOS El Capitan 10.11.1 etc.
Step 14: Finally Installed
HomeBrew has now finished installing, has been configured to be found every time you use Terminal, has been updated and upgraded and checked that all is fine.
You can now install any application that is in the HomeBrew database.