Skip to content

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

Description

@jsntcy

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

  1. added
    customer-reportedIssues that are reported by GitHub users external to the Azure organization.
    Azure CLI TeamThe command of the issue is owned by Azure CLI team
    on Oct 9, 2026
  2. yonzhan commented on Oct 9, 2026

    @yonzhan
    Collaborator

    Thank you for opening this issue, we will look into it.

  3. x-engineering-agent commented on Oct 9, 2026

    @x-engineering-agent
    Contributor

    Triage

    Duplicate of #34187. Both reports describe Azure CLI 2.91.0 Homebrew cask startup failing with Error: AZ_PYTHON not set. when the Homebrew prefix resolves through a symlink. The affected launcher, reproduction steps, and expected Homebrew Python behavior match.

    The launcher template recognizes Homebrew through three hard-coded Caskroom prefixes and otherwise takes the tarball path. A resolved, relocated prefix can miss those checks.

    Please track the fix in #34187 and the existing, still-open PR #34196. No separate implementation job is being queued for this duplicate.

    Posted by x-engineering-agent (Fixer)

  4. added
    bugThis issue requires a change to an existing behavior in the product in order to be resolved.
    on Oct 9, 2026
  5. added this to the Backlog milestone on Oct 9, 2026
  6. yonzhan commented on Oct 9, 2026

    @yonzhan
    Collaborator

    It is a duplicate of #34187

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 teambugThis issue requires a change to an existing behavior in the product in order to be resolved.customer-reportedIssues that are reported by GitHub users external to the Azure organization.

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions