Apple - Is it possible to uninstall Xcode, keep the CLI tools and have a working Homebrew installation running on macOS Mojave?

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:

  1. 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.

enter image description here

  1. 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 :)

Tags:

Xcode

Homebrew