How to delete Command Line Tools while keeping Xcode? [duplicate]
Xcode.app provides a set of command line tools. Standalone 'Xcode Command Line Tools' provides another set. You can switch between them (see xcode-select --help
).
git
, gcc
and many commands in /usr/bin/
is actually a jumper to the real executable of selected CLT.
Standalone CLT is almost unnecessary if you have Xcode.app installed. You can simply trash /Library/Developer/CommandLineTools
to remove it.
In my case it installed these pkg (pkgutil --pkgs
before and after installation)
com.apple.pkg.DevSDK_macOS1013_Public
com.apple.pkg.CLTools_Executables
com.apple.pkg.DevSDK
com.apple.pkg.CLTools_SDK_macOSSDK
com.apple.pkg.macOS_SDK_headers_for_macOS_10.14
com.apple.pkg.DevSDK_OSX109
com.apple.pkg.CLTools_SDK_macOS1013
com.apple.pkg.CLTools_SDK_macOS1014
com.apple.pkg.DevSDK_OSX1012
com.apple.pkg.DevSDK_OSX1011
com.apple.pkg.DevSDK_OSX1010
You can use pkgutil --files <pkg_name>
to see installed files. They are either in /tmp
or /Library/Developer/CommandLineTools
.
However,
brew
sometimes requires you to install standalone CLT even you have Xcode.app installed, namelypython
. They say some bottles (pre-built) are linked against the standalone CLT.brew
also requires standalone CLT when I want to build something on non-current system (Mojave after Catalina released).
Of course, you can take the risk and edit the brew formula or brew itself to avoid that.
brew edit python
# setuptools remembers the build flags python is built with and uses them to
# build packages later. Xcode-only systems need different flags.
pour_bottle? do
reason <<~EOS
The bottle needs the Apple Command Line Tools to be installed.
You can install them, if desired, with:
xcode-select --install
EOS
satisfy { MacOS::CLT.installed? } # comment this out
end
/usr/local/Homebrew/Library/Homebrew/os/mac/xcode.rb:
def needs_clt_installed?
return false # <- add this
return false if latest_sdk_version?
without_clt?
end