Homebrew / install

📥 Homebrew (un)installer
https://brew.sh
BSD 2-Clause "Simplified" License
2.15k stars 1.02k forks source link

Homebrew package installer does not work with Xcode alone #831

Closed fraserhess closed 8 months ago

fraserhess commented 8 months ago

What you were trying to do (and why)

Run the Homebrew package installer on a Mac (macOS 13.6) with Xcode installed.

What happened (include command output)

An error is thrown when running trying to install the package:

Homebrew 1

What you expected to happen

Homebrew would install successfully.

The Distribution.xml checks for the presence of /Library/Developer/CommandLineTools/usr/bin/git but not for /Applications/Xcode.app/Contents/Developer/usr/bin/git. This is in contrast to the postinstall that extends PATH for both /Library/Developer/CommandLineTools/usr/bin and /Applications/Xcode.app/Contents/Developer/usr/bin

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

  1. Install Xcode to /Applications
  2. Download Homebrew package installer
  3. Open package
Bo98 commented 8 months ago

CLT is a requirement for non-latest macOS (so macOS 13.6 counts), so this is expected. The latest Xcode.app does not ship MacOSX13.sdk but the CLT does.

I guess it doesn't universally matter for every formulae if you're not building from source, but we don't make that distinction on installer level.

Things like Python however do still need the CLT at the moment regardless: https://github.com/Homebrew/homebrew-core/blob/13fda40c2e56386c3c969fc1bc0e186095228dc7/Formula/p/python@3.11.rb#L24-L26

MikeMcQuaid commented 8 months ago

This is a known limitation. I was not able to find an approach that worked consistently for Xcode alone and checked for the necessary version. Given what @bo98 said and that our Bash-based installer requires the CLT globally: considering this not a bug but something we'll review a PR for if you can fix it. Sorry!