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,
Verify that you have Apple Silicon. You should see
$ uname -m arm64
Add Homebrew to your path.
$ 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
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 WILL 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"' >> /Users/awdeorio/.bash_profile ...
Close your terminal and reopen your terminal. Your version might be different.
$ java --version openjdk 16.0.1 2021-04-20
Original document written by Andrew DeOrio firstname.lastname@example.org.
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.