Skip to content

macOS .pkg installer fails to detect Xcode if it's on another volume #15802

@misterfifths

Description

@misterfifths

brew doctor output

N/A, this issue is with the new .pkg installer.

Verification

  • My "brew doctor output" above says Your system is ready to brew. and am still able to reproduce my issue.
  • I ran brew update twice and am still able to reproduce my issue.
  • This issue's title and/or description do not reference a single formula e.g. brew install wget. If they do, open an issue at https://github.com/Homebrew/homebrew-core/issues/new/choose instead.

brew config output

N/A

What were you trying to do (and why)?

Install Homebrew on macOS using the .pkg installer. This seems to reproduce on the latest versions of Monterey and Ventura, as well as beta 4 of Sonoma.

What happened (include all command output)?

The fileExistsAtPath call in installation-check script in Distribution.xml fails if the path is on another volume. In my case, /Applications/Xcode.app was a symlink to another volume (and I didn't have the CLTs installed), so the installer was convinced that it couldn't proceed.

This output is generated in /private/var/log/install.log:

Installer[63009]: IFJS: Package Authoring Error: access to path "/Applications/Xcode.app/Contents/Developer/usr/bin/git" requires <options allow-external-scripts='true'>

Adding that option to the Distribution.xml file does indeed fix the issue, but it results in this ominous warning from productbuild:

productbuild: [WARNING]: Specifying [allow-external-scripts='true'] is deprecated.
           Having this in your distribution will break the installability
           of this product in an upcoming release of macOS.
           Apple reserves the right to reject notarization of any product with this option.

I believe that this is an Apple bug. allow-external-scripts as documented has nothing to do with checking file existence, only running arbitrary executables through the JS interface. I filed FB12823044 with Apple.

In the meantime, perhaps adding allow-external-scripts is an option? I'm not sure if Apple is actually rejecting such packages at notarization time. On the other hand, maybe this is too niche of a circumstance to worry about.

What did you expect to happen?

The installer should detect an Xcode or CLT install even if it's a symlink to another volume.

Step-by-step reproduction instructions (by running brew commands)

  1. Make sure you do not have the CLTs installed, or the installation-check script will detect them first and not encounter this error.
  2. Symlink /Applications/Xcode.app to an app on another volume.
  3. Open the .pkg installer and immediately see a dialog for the fatal error (and the "Package Authoring Error" in install.log).

(Alternatively you could symlink /Library/Developer/CommandLineTools to another volume instead of Xcode.app. Or just the git file that the script is checking. Any path that winds up on another volume seems to trigger this error.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    outdatedPR was locked due to age

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions