You will need to install the Apple Xcode developer tools application from the App Store.
🔒 You will need an Apple ID to sign into the App Store to download XCode
⏩ Try clicking this link in Safari and following any prompts to allow opening the App Store https://apps.apple.com/us/app/xcode/id497799835 it might take you right to Xcode in the App Store or...
-
Open the App Store application
-
Use the App Store's search box to search for
xcode
which should return the Xcode Developer Tools application -
Follow the App Store download and installation process to install Xcode - You will must likely be prompted at some point to log in with your Apple ID if you are not already logged in.
⏳ It may take awhile for Xcode to download and install
🍺 Homebrew is a package manager for Mac. You use it to make it easier to install and manage your programs and utilities needed for development and some applications such as Chrome, Docker, VS Code etc.
✨ The Homebrew install script will start by installing (XCode) Command Line Tools which includes the
gcc
compiler
-
Go to https://brew.sh/ and follow the installation instructions for Mac or you can try the following command (which came from the site at the time of this post)
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
-
READ the output of the installation and follow any instructions
To install Command Line Tools, you will probably need to complete the installation in...
System Settings > General > Software Update
Depending on the Mac architecture, Homebrew is installed...
FOR... | INSTALLED AT... |
---|---|
Apple Silicon | /opt/homebrew |
macOS Intel | /usr/local |
The Homebrew install script output should tell you
what lines to add to your ~/.zshrc
(~/.zprofile
) file.
At the time of this post for Apple Silicon-based macOS Sonoma, the instructions directs you to (edit and) add the following lines to your
~/.zshrc
(~/.zprofile
) fileeval "$(/opt/homebrew/bin/brew shellenv)"
I peeked into the homebrew script source and have this in my basic mac-dev-zsh-profile repository which works for either architecture...
# Add brew shellenv to your ~/.zshrc file"
# This is inside baseball from the brew install script
# Determine where brew itself is installed based on Intel vs Apple Silicon
[[ `uname -m` == "arm64" ]] && homebrew_prefix="/opt/homebrew" || homebrew_prefix="/usr/local"
eval "$(${homebrew_prefix}/bin/brew shellenv)"
unset homebrew_prefix
After installing Homebrew, you can now start installing your system libraries, tools, and programs and have them managed by Homebrew.
To verify that Command Line Tools and the
gcc
compiler is successfully installed...
gcc --version
You should see output something like this...
Apple clang version 15.0.0 (clang-1500.0.40.1)
Target: arm64-apple-darwin23.1.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
Once Homebrew is installed, you will have git
available.
There will not be any configuration or credentials but you do have https access to public repositories. You can keep basic configuration and setup scripts to automate your setup from here.