Removing XCode while keeping the command line tools (on El Capitan)

command linexcode

As by subject. There are a number of links, such as this that deal with the issue but are not El Capitan specific and/or are just not that on the subject or are not up to date.

Is it possible to Uninstall XCode 7 while keeping the Command Line Tools (and still being able to get the CLT upgrades)? Should I just uninstall everything and reinstall just the CLT (how?)?

Any other way?

Best Answer

Personally, I think that instead of trying to "bodge" a method of uninstalling Xcode while leaving CLT intact is too cumbersome. My suggestion is to:

  1. Uninstall Xcode completely
  2. Install Xcode CLT

Doing this should take you less than 5 minutes total and is quite simple.


Uninstall Xcode

There are a number of different ways to uninstall Xcode. An excellent tutorial can be found at OSXDaily.

However, the most reliable way I have found to uninstall software is with the free app recommended by Macworld.com called AppCleaner. You can "drag and drop" or "Search" for your apps that you want to remove and it will find all related files/directories for you - even the ones that get installed as launch daemons.

Disclaimer: I am not affiliated with the app or the developers of the app in any way.

Install Xcode CLT (Yosemite through Sierra)

Installing Xcode CLT is actually quite simple. In Terminal, execute the following command:

xcode-select --install

You will get a dialog box that will prompt you to "Get Xcode," "Cancel," or "Install." Select "Install" to install the CLT only.

xcode-select install dialog

The installer will do its thing and will notify you once it's complete. Once finished, you will have access to tools such as git and svn. You can execute those commands by testing them out in Terminal.

CLT will be installed to /Library/Developer/CommandLineTools/

That's it! Xcode CLT are installed and ready for use.