p1-insta485-static

macOS command line tools

macOS comes with a Terminal and can run UNIX command-line tools directly.

Homebrew package manager

Install the Homebrew package manager.

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

Apple Silicon users (“M1”, “M2”, etc.) only. At the time of this writing (2022), Homebrew installs to a non-standard location, /opt/homebrew (docs).

Verify that you have Apple Silicon. You should see arm64, not x86_64.

$ uname -m
arm64

Add Homebrew to your path. If you’re a power user and you customized your shell, your shell’s rc file may be different. This is not common.

$ echo 'eval $(/opt/homebrew/bin/brew shellenv)' >> ~/.zprofile

Close your terminal and reopen your terminal.

Check your install. Your version might be different.

$ brew --version
Homebrew 3.6.14

Install CLI tools

Use Homebrew to install Python and a few other packages.

$ brew install python3 java git tree wget

Java

Some macOS machines already have a Java interpreter installed. If you have version 8 or higher, you don’t need to do anything.

$ java --version
openjdk 14.0.2 2020-07-14

If you don’t have Java installed, use Homebrew to install it.

$ brew install java

After installing Java, Homebrew will probably give you a warning about adding it to your PATH. Follow the instruction that looks like the one below. YOUR COMMAND MAY BE DIFFERENT!

$ brew info java
...
If you need to have openjdk first in your PATH, run:
  echo 'export PATH="/usr/local/opt/openjdk/bin:$PATH"' >> ~/.zshrc
...

Close your terminal and reopen your terminal. Your version might be different.

$ java --version
openjdk 16.0.1 2021-04-20

Acknowledgments

Original document written by Andrew DeOrio awdeorio@umich.edu.

This document is licensed under a Creative Commons Attribution-NonCommercial 4.0 License. You’re free to copy and share this document, but not to sell it. You may not share source code provided with this document.