Configuring macOS Sierra 10.12Last updated: April 15, 2017
macOS, formerly known as Mac OS X, can be made more powerful with command-line tools such as those available via Homebrew. This tutorial covers installing Homebrew and other useful initial configuration.
Turning off automatic updates
If you prefer to be in control of when updates are downloaded and installed, open System Preferences, go to the App Store preference pane, and uncheck the relevant boxes.
Unhide the Library folder
macOS hides the
~/Library folder by default, but it is easy to make it visible again.
With the Finder as the foremost application, press shift-command-H, command-2, and then command-J, which will bring up a window that configures Finder view options. Check the “Show Library Folder” and close the window. Thanks to the Apple engineers that made this process more user-friendly than it has been in the past.
Bash profile setup
Since the macOS default
/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin, we’ll want to change it so that certain Homebrew installations (e.g., Python) will take precedence over stock macOS binaries. To make these changes, open
… and add:
# Ensure user-installed binaries take precedence export PATH=/usr/local/bin:$PATH # Load .bashrc if it exists test -f ~/.bashrc && source ~/.bashrc
Since the above directives will take effect on the next login, let’s go ahead and source the file to ensure it takes effect for the current session:
With those first steps out of the way, now it’s time to briefly cover Xcode and compilation tools.
Installing development-related software in the past has required the compiler tool-chain that comes with Xcode. Thankfully, if you don’t need or want Xcode, those compiler tools are now available separately, saving download time and many gigabytes of disk space.
Alternatively, there are some reasons you might want the full version of Xcode:
- To compile the few tools that won’t compile without Xcode
- To download and manually compile open-source Mac applications
- To develop your own Mac/iOS applications
If you don’t need Xcode, you can skip ahead now to the Homebrew section below, since that step will automatically install Apple’s Command Line Tools. If you want to install Xcode, or if you prefer to install the Command Line Tools manually instead of having Homebrew take care of it for you, run the following command in the Terminal:
You will then be asked whether you want to install Xcode or the command line developer tools, with the latter being the default. If you choose the Get Xcode option, after installation has completed be sure to launch the Xcode application once to accept the EULA.
Sometimes you may need cross-platform software — usually without a GUI and accessible only via the command line — that isn’t readily available via the Mac App Store. Homebrew provides an easy way to install these packages, so let’s fire up Terminal.app and install it:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Follow the prompts to download and install Homebrew, entering your administrative password when prompted. Then run the following command to ensure that there aren’t any potential problems with your environment. Some warnings (if any) are informational and not necessary actionable; it’s just a good idea to at least read through and see if anything looks out of the ordinary.
The following command will update to the latest version of Homebrew and its formulae:
Let’s use Homebrew to install some packages that I often find useful:
brew install bash-completion ssh-copy-id wget
You can run
brew info ssh-copy-id, for example, if you want to know what those packages do.
Some Homebrew formulae recommend post-installation steps. For example, to activate bash completion, add the following to your
if [ -f $(brew --prefix)/etc/bash_completion ]; then source $(brew --prefix)/etc/bash_completion fi
There are many other useful Homebrew commands, all of which can be seen by running
man brew in the terminal.
Just the basics
These are obviously just the basics. If you have any interest in Python, have a look at my guide to setting up a Python Development Environment on macOS.