Describe the bug
With the new Homebrew cask (brew install --cask azure-cli, 2.91.0), az fails on a Mac where the Homebrew prefix is a symlink (here /opt/homebrew -> /private/.bulk/opt/homebrew, which itself resolves to another volume):
Error: AZ_PYTHON not set.
For offline/tarball installs, set AZ_PYTHON to a Python 3.14 path.
Cause: scripts/release/standalone/templates/az_launcher.sh.in resolves its own path with cd -P (physical), then compares the result against literal prefixes:
if [[ "$SCRIPT_PATH" == /opt/homebrew/Caskroom/* ]] || \
[[ "$SCRIPT_PATH" == /usr/local/Caskroom/* ]] || \
[[ "$SCRIPT_PATH" == /home/linuxbrew/.linuxbrew/Caskroom/* ]]; then
bash -x shows the resolved path is /Volumes/Data/.bulk/opt/homebrew/Caskroom/azure-cli/2.91.0/bin/../libexec/bin/az, so INSTALLER=TARBALL and the launcher demands AZ_PYTHON, even though it is a cask install and python@3.14 is installed. The same happens with any custom Homebrew prefix.
To reproduce
- Make the Homebrew prefix a symlink to another location (for example, a prefix relocated to a second volume).
brew install --cask azure-cli
az version
Expected behavior
The cask install is detected and uses Homebrew's python@3.14, with no AZ_PYTHON needed.
Suggestions
- Detect a cask install by pattern rather than literal prefix, for example
*/Caskroom/azure-cli/*. Or compare against the physical path of $HOMEBREW_PREFIX, or brew --prefix.
- Minor: the first candidate,
opt/python@3.14/libexec/bin/python3, doesn't exist in Homebrew's python@3.14 (its libexec/bin has python, not python3). Detection only works because of the bin/python3.14 fallback.
Workaround
export AZ_PYTHON="$HOMEBREW_PREFIX/opt/python@3.14/bin/python3.14"
Environment
- azure-cli 2.91.0, Homebrew cask (Homebrew 7.0.8), macOS 27 on Apple silicon
- Homebrew prefix:
/opt/homebrew, a symlink to /private/.bulk/opt/homebrew
Describe the bug
With the new Homebrew cask (
brew install --cask azure-cli, 2.91.0),azfails on a Mac where the Homebrew prefix is a symlink (here/opt/homebrew -> /private/.bulk/opt/homebrew, which itself resolves to another volume):Cause:
scripts/release/standalone/templates/az_launcher.sh.inresolves its own path withcd -P(physical), then compares the result against literal prefixes:bash -xshows the resolved path is/Volumes/Data/.bulk/opt/homebrew/Caskroom/azure-cli/2.91.0/bin/../libexec/bin/az, soINSTALLER=TARBALLand the launcher demandsAZ_PYTHON, even though it is a cask install andpython@3.14is installed. The same happens with any custom Homebrew prefix.To reproduce
brew install --cask azure-cliaz versionExpected behavior
The cask install is detected and uses Homebrew's
python@3.14, with noAZ_PYTHONneeded.Suggestions
*/Caskroom/azure-cli/*. Or compare against the physical path of$HOMEBREW_PREFIX, orbrew --prefix.opt/python@3.14/libexec/bin/python3, doesn't exist in Homebrew'spython@3.14(itslibexec/binhaspython, notpython3). Detection only works because of thebin/python3.14fallback.Workaround
export AZ_PYTHON="$HOMEBREW_PREFIX/opt/python@3.14/bin/python3.14"Environment
/opt/homebrew, a symlink to/private/.bulk/opt/homebrew