Homebrew is a package manager for Mac, which installs useful things that Apple forgot.


You can’t make this stuff up. brew commands may require Apple Command Line Developer tools to be installed. If you get errors about xcrun, you need to install them separately. See: xcode-select

Follow the Homebrew install instructions.


brew update


Managing packages

# Show installed packages
brew list -l

# Install a package
brew install {packageName}

# Show outdated packages
brew outdated

# Upgrade all packages
brew upgrade

# Upgrade a package
brew upgrade {packageName}

# Uninstall a package
brew uninstall {packageName}

# Show package info (like where it's installed)
brew info {packageName}

Cleaning up

# Remove all old packages
brew cleanup

# Remove all old packages (dry run)
brew cleanup -n

# Remove old symlinks
brew prune

Installed packages

  • php@5.6
  • php@7.1


Switch PHP version

You have to edit your .zshrc shell profile.

Totally remove and reinstall package

Updating the PHP package may not remove old php.ini files, which breaks things. You have to remove them manually.

Fixing unlinked packages

When installing a packages, Homebrow might be unable to create symlinks into /usr/local/sbin. This is required so packages are available in the shell’s PATH variable.

# Check which packages are not symlinked properly:
brew doctor

# Check if the `/usr/local/sbin` directory exists:
cd /usr/local/sbin

# If not, create the directory:
cd /usr/local
mkdir sbin

# Change permissions so the directory is writeable by the system:
sudo chown -R `whoami`:admin /usr/local/sbin

# Link the packages:
brew link {packageName}