Is it possible to uninstall Xcode, keep the CLI tools and have a working Homebrew installation running on macOS Mojave?
I am trying to claw back as much disk space as possible, and I have no use for Xcode aside from the fact it provides the Command Line Tools I need for using Homebrew. Can I:
Remove Xcode (how to do so properly?)
Install Command Line Tools (I can download them as a developer BTW)
Have a working Homebrew installation
You don't need to have Xcode installed on your system to install Command Line Tools. Command Line Tools can be installed independently from Xcode.
For your scenario, to remove Xcode, take either one of the two approaches depending on how you installed it in first place:
-
If you have installed Xcode via Mac App Store, simply open Launchpad, press and hold the Alt key, and click on the cross button shown towards top left of the Xcode app icon.
This will uninstall Xcode completely.
- If you have installed Xcode via copying from a DMG, simply trash the Xcode.app bundle.
Once you have uninstalled Xcode, you can independently install only the Command Line Tools by running the following in Terminal:
xcode-select --install
You don't need to have an Apple Developer account for doing so, neither will you need to download anything directly from Apple Developer website.
Running xcode-select --install
didn't work for me after deleting Xcode through Launchpad, because Terminal response was
error: command line tools are already installed, use "Software Update" to install updates
In App Store Xcode looked deinstalled and also downloading the Command Line Tools from https://developer.apple.com and installing them from the .dmg didn't fix this.
I then ran
sudo xcode-select -s /Library/Developer/CommandLineTools
(found in https://stackoverflow.com/questions/34617452/how-to-update-xcode-from-command-line) and now everything works just fine and I saved ca. 17GB of space :)
Yes.
I did it a while ago, so I can't recall exactly how I uninstalled Xcode. If there isn't an uninstall option in the App Store, then I just moved Xcode to the trash and deleted it.
I was able to install the command line tools by:
- going to https://developer.apple.com
- logging in
- going to Account > Downloads > See More Downloads
and there is an item called Command Line Tools (macOS 10.14) for XCode 10.2