Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Detect the presence of Xcode instead of downloading Xcode Command Line Tools #11250

Closed
iranvir opened this issue Apr 26, 2021 · 3 comments
Closed
Labels
features New features outdated PR was locked due to age

Comments

@iranvir
Copy link

iranvir commented Apr 26, 2021

Provide a detailed description of the proposed feature

When installing Brew, I am forced to install Xcode CLT (command line tools) despite the fact that I already had XCode installed. Given that Xcode already comes with all the necessary tools, I think we should have an option to not download and/or install CLT

What is the motivation for the feature?

I have the following reasons for this:

  1. Using CLT might cause other (non-brew) tools to switch to command line tools as well. I haven't had such issues but I would rather not risk it.
  2. Saved disk space. I have a crowded 256GB MacBook and every byte not wasted in redundant packages is helpful.

How will the feature be relevant to at least 90% of Homebrew users?

I expect not many users have a fully speced out mac, so not wasting storage space might help them all. But honestly, I don't know.

What alternatives to the feature have been considered?

If detecting the presence of Xcode is not possible. The installation script should just print a message asking if it is installed or not.

@iranvir iranvir added the features New features label Apr 26, 2021
@Bo98
Copy link
Member

Bo98 commented Apr 26, 2021

There is a couple of formulae which do require the CLT to be installed due to baked in paths, such as Python. Since we have to choose, we prefer requiring the CLT (less than half a GB; fixed location) rather than the full Xcode.app (several GB; variable location), and in the case of older OS (Catalina and earlier) it is even the only option since only the CLT has older SDKs.

@iranvir
Copy link
Author

iranvir commented Apr 26, 2021

Understood! Feel free to close this issue.
Just of out curiousity. Would this cause any conflicts when using tools from Xcode.app in command line or elsewhere? If so, is there a workaround that I could employee?

@Bo98
Copy link
Member

Bo98 commented Apr 26, 2021

Would this cause any conflicts when using tools from Xcode.app in command line

No, the actual binary tools used doesn't matter. They're usually the same between Xcode and the CLT and we can rely on the /usr/bin path to allow either to be used.

What does matter is SDKs, e.g. /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk. For formulae which reference the SDK, then we prefer the CLT path as it's the only one that is in a fixed location (and for older OS versions, the only one to exist). However, you can rebuild formulae from source to use the Xcode SDK path (if on the latest macOS) - this will usually work without any changes. In fact, this will be what is suggested by brew install when you install a formula like Python. There's not too many formulae where this is necessary - the only other examples I remember is GCC, LLVM and swift-format.

@github-actions github-actions bot added the outdated PR was locked due to age label May 27, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 27, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
features New features outdated PR was locked due to age
Projects
None yet
Development

No branches or pull requests

3 participants