Removing XCode while keeping the command line tools (on El Capitan)
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:
- Uninstall Xcode completely
- 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.
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.