scripts/prereqs-macos.sh¶
Platforms: macOS.
Purpose¶
prereqs-macos.sh installs the command-line prerequisites setup.sh
needs, using Homebrew: the Xcode Command Line Tools, Python 3.12+, Git, the
Azure CLI, and — unless skipped — the .NET SDK, the Microsoft Agent 365
DevTools CLI (a365), and PowerShell 7+. 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¶
# Install everything (core tools + .NET SDK/a365 + PowerShell 7)
./scripts/prereqs-macos.sh
# Skip the .NET SDK and Agent 365 DevTools CLI
./scripts/prereqs-macos.sh --skip-a365
# Skip PowerShell 7
./scripts/prereqs-macos.sh --skip-pwsh
# Skip both optional groups — only the core tools setup.sh strictly requires
./scripts/prereqs-macos.sh --core-only
Options¶
--skip-a365— skip installing the .NET SDK and the Microsoft Agent 365 DevTools CLI (a365). Usesetup.sh --with-a365-work-iqlater to add them when Work IQ is needed.--skip-pwsh— skip installing PowerShell 7+. Only needed forsetup.sh --configure-a365-work-iq.--core-only— shorthand for--skip-a365 --skip-pwsh.-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. - .NET SDK +
a365(skipped by--skip-a365/--core-only) — installs thedotnetHomebrew formula, then installs or updates the Microsoft Agent 365 DevTools CLI viadotnet tool install/update --global Microsoft.Agents.A365.DevTools.Cli, adding~/.dotnet/toolstoPATHfor the rest of the run. - PowerShell 7+ (skipped by
--skip-pwsh/--core-only) — installs thepowershellHomebrew formula ifpwshis missing. - Runs a final validation pass re-checking every tool it was asked to install (skipping checks for groups that were skipped) and prints a summary of what was already present, newly installed, and failed.
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 newly installed tools are not yet visible onPATHin the current shell (most commonlypython3.12ora365right after their first install). The script warns and tells the operator to open a new terminal before runningsetup.sh.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 — 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.