Hacker Codex   Linux servers · Python development · macOS tinkering

Configuring macOS 11 Big Sur and Catalina

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 Software Update preference pane, and uncheck the relevant boxes.

Un-hide 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.

Compiler

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:

xcode-select --install

You may be asked whether you want to install Xcode or the command line developer tools, with the latter being the default. If you choose to install Xcode, after installation has completed be sure to launch the Xcode application once to accept the end-user license agreement (EULA).

Homebrew

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:

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

Follow the prompts to download and install Homebrew, entering your administrative password if prompted. Don’t forget to perform any post-installation steps that Homebrew indicates, such as adding brew shellenv configuration to your shell environment. 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.

brew doctor

The following command will update to the latest version of Homebrew and its formulae:

brew update

Let’s use Homebrew to install some useful packages:

brew install zsh-completions 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 Zsh completions, add the following to your ~/.zshrc:

if type brew &>/dev/null; then
    FPATH=$(brew --prefix)/share/zsh-completions:$FPATH
    autoload -Uz compinit
    compinit
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.

If you found this article to be useful, feel free to find me on Twitter.


Want to be notified when I publish new technical tutorials?