Skip to content

Instantly share code, notes, and snippets.

@edm00se
Last active May 28, 2021 15:01
Show Gist options
  • Save edm00se/c63897932d35ceffaa22f42428720e71 to your computer and use it in GitHub Desktop.
Save edm00se/c63897932d35ceffaa22f42428720e71 to your computer and use it in GitHub Desktop.
Mac Setup for Homebrew, Casks, and Required Xcode CLI Tools

Installing Homebrew for Mac

Note: If you're not running a recent version of macOS (formerly known as Mac OS X), you may need to address a few items. Please consult the below NotesForOlderMacs.md.

1. Install Xcode CLI Tools (only)

xcode-select --install

Run from a CLI (command line interface), such as Terminal.app (found in the /Applications/Utilities/ directory). This will perform the install of the command line tools for Xcode, as opposed to a full Xcode install; you may alternately perform the full Xcode install.

2. Install Homebrew

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

This command will use ruby (a language included in the Xcode cli tools) to download a well maintained install script, to perform the install and setup of homebrew (and the brew command). The $(curl ...) portion performs a download of the install script and passes it to the ruby command to execute. Feel uncomfortable executing code you didn't write? Read the install script for yourself.

Search

brew search wget

Install

brew install wget

Use

Use like normal!

wget --help

3. Setup (Tap) Homebrew Cask

brew tap caskroom/cask

This taps the cask caskroom. This makes all cask content available for search and install.

Search

brew cask search google-chrome

Alternatively, cask availablility will return under a normal brew search command, such as brew search google-chrome.

Install

brew cask install google-chrome

Use

Use like normal! Google Chrome is now an application in your /Applications/ directory, accessible via Finder, Launchpad, etc.

Why?

Homebrew is about the easiest way to install tools for Mac. Homebrew Cask is about the easiest way to install a GUI application, which does perform a native install, it's just tracked to be more easily upgraded.

Older Macs

You probably need to:

  • install XCode CLI Tools (which can be difficult on older versions)
  • update OpenSSL
  • upgrade git

Install XCode CLI Tools

You can use a helper shell script to do this for you. The source comes from this gist. Alternatively, view its source, follow the code, and find your corresponding version of XCode CLI Tools and install accordingly.

Copy + Paste

If you don't have a new enough version of OpenSSL, you won't be able to download the script with wget or curl, so just open the link manually in a web browser and save the file with the same name below, on your Desktop.

From a Terminal session:

  • (if able, per note above) curl -O https://gist.github.com/rtrouton/f92f263414aaeb946e54/raw/9ac37d561c38d54ff7fc31dee66e89d10fc3e2b9/gistfile1.sh
  • mv gistfile1.sh xcode-cli-tools-install.sh
  • chmod +x xcode-cli-tools-install.sh
  • sudo sh xcode-cli-tools-install.sh

This script when run, the last line, will download the installer package, perform the install, and remove the dmg once finished.

Updating OpenSSL

1. Install Mac Ports

2. Install OpenSSL from Mac Ports

You can confirm your current version of OpenSSL with the command openssl version.

Install the latest version from Mac Ports with:

sudo port install openssl

Upgrade Git

Download and install the latest version of Git for Mac from git-scm.com.

https://git-scm.com/download/mac

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment