How to delete Command Line Tools while keeping Xcode? I recently purchased a new Mac and I am currently in the process of setting it up as a development machine.

Before installing Xcode I went ahead and installed:


Sublime Text
Sublime Merge


While setting up Sublime Merge I was prompted to install the Xcode Command Line Tools (Macintosh HD -&gt; Library -&gt; Developer -&gt; Command Line Tools).

I went ahead and did that, and was able to successfully set up my repos on Sublime Merge.

I then installed Xcode which comes bundled with the Command Line Tools in its own package (Applications -&gt; Xcode -&gt; Contents -&gt; Developer).

Right after installing Xcode I saw that in Software Update I had an update to the Command Line Tools and so I performed that.

I'm striving for a clean set up and was wondering whether or not I now have redundant copies of the Command Line Tools, if so, how do I (or do I even need to) get rid of the old tools safely?
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 &lt;pkg_name&gt; 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, namely python. 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 &lt;&lt;~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 # &lt;- add this
        return false if latest_sdk_version?

        without_clt?
      end