scripts/prereqs-macos.sh¶
Platforms: macOS.
Purpose¶
prereqs-macos.sh installs command-line tools on a Mac with Homebrew: the
Xcode Command Line Tools, Python 3.12+, Git and the Azure CLI. It is optional.
setup.sh needs only Python 3.12 or later, and offers to install
its own private Azure CLI when there is none, so this script is a convenient way
to get Python, not a required step.
Microsoft's Agent 365 CLI (a365), the .NET SDK it runs on, and PowerShell 7
are no longer installed by default: setup switches on Word, Excel and OneDrive
files by itself, without them. --with-a365-cli installs them anyway, for using
the Agent 365 CLI yourself.
It is safe to re-run; each step detects an existing install and skips straight to the next one.
Requirements¶
- macOS only. The script checks
uname -sforDarwinand exits1on any other platform, pointing Linux users at their package manager and Windows users atprereqs-windows.ps1. - Homebrew must already be installed. The script does not install
Homebrew itself — Homebrew's own installer needs
sudoand an interactive EULA acceptance, which this script cannot safely automate. Ifbrewis not onPATH(checking both the Apple Silicon and Intel prefixes), it prints the official install command and exits1. - A working internet connection for Homebrew downloads.
Usage¶
# What setup can use: Xcode Command Line Tools, Python 3.12+, Git, Azure CLI
./scripts/prereqs-macos.sh
# Also the .NET SDK, Microsoft's Agent 365 CLI and PowerShell 7
./scripts/prereqs-macos.sh --with-a365-cli
Options¶
--with-a365-cli— also install the .NET SDK, the Microsoft Agent 365 DevTools CLI (a365) and PowerShell 7+. Setup does not need any of them.--core-only,--skip-a365,--skip-pwsh— still accepted. They leave out the .NET SDK anda365(--skip-a365), PowerShell 7 (--skip-pwsh), or both (--core-only), which is now the default. Given after--with-a365-cli, they leave those parts out again.-h,--help— print the script's header comment as usage text and exit0.- Any unrecognized argument prints
ERROR: Unknown argument: <arg>to stderr, then falls through to the same help text as--helpand exits0— it does not abort with a non-zero status.
Effects¶
- Verifies macOS and resolves the Homebrew prefix (
/opt/homebrewor/usr/local), exporting it ontoPATHfor the rest of the run if not already present. - Xcode Command Line Tools — if not already installed
(
xcode-select -p), triggersxcode-select --install, which opens a system dialog. This step is interactive: the script prints a prompt and blocks onreaduntil the operator accepts the dialog and presses Enter. - Python 3.12+ — probes
python3.13,python3.12, thenpython3for a version ≥ 3.12; installspython@3.12via Homebrew if none qualify. - Git — installs via Homebrew only if no
gitis already onPATH(Xcode CLT usually provides one). - Azure CLI — installs
azure-clivia Homebrew ifazis missing. Setup uses anazonPATHwhen there is one. - .NET SDK +
a365(only with--with-a365-cli) — installs thedotnetHomebrew formula, then installs or updates the Microsoft Agent 365 DevTools CLI as a global .NET tool, adding~/.dotnet/toolstoPATHfor the rest of the run. Without the option, it prints that it is not installed because setup does not need it. - PowerShell 7+ (only with
--with-a365-cli) — installs thepowershellHomebrew formula ifpwshis missing. - Runs a final validation pass re-checking every tool it was asked to
install (skipping the parts it left out) and prints a summary of what was
already present, newly installed, and failed, then the next step:
./scripts/setup.sh.
Exit behavior¶
0— all requested tools are installed and confirmed onPATH,--helpwas requested, or an unrecognized argument was passed (help text is shown first).0— installs all succeeded but one or more tools are not yet visible onPATHin the current shell (most commonlypython3.12, ora365right after its first install). The script warns and tells the operator to open a new terminal before runningsetup.sh. The validation pass looks forpython3.12by that name, so a Mac whose only new-enough Python ispython3.13also gets this warning; setup itself usespython3.13.1— not running on macOS, Homebrew is missing, Xcode CLT installation did not complete, or any Homebrew install step failed.
Common failures¶
Homebrew not found— install it with the official one-liner printed by the script, then re-run.- Stuck at the Xcode CLT dialog — the system dialog can appear behind other windows; check the Dock, accept it, then return to the terminal and press Enter.
python3.12 not on PATHafter install — open a new terminal (Homebrew changes toPATHonly take effect in new shells) and re-run.a365missing after install (with--with-a365-cli) — same PATH-refresh issue for~/.dotnet/tools; the script prints the exactexport PATHline to add to~/.zshrcif needed.
Related commands¶
- Script reference — Setup
setup.sh— the script this prepares the machine for.prereqs-windows.ps1— the Windows counterpart.- macOS / Linux installation.