Skip to content

Homebrew cask launcher asks for AZ_PYTHON when the Homebrew prefix is a symlink #34187

Description

@Naimor-HM

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

  1. Make the Homebrew prefix a symlink to another location (for example, a prefix relocated to a second volume).
  2. brew install --cask azure-cli
  3. 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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Azure CLI TeamThe command of the issue is owned by Azure CLI teamcustomer-reportedIssues that are reported by GitHub users external to the Azure organization.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions