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.