CleanMate

All guides · macOS · Updated

How to uninstall Xcode and the Command Line Tools cleanly on a Mac

Remove Xcode completely: the app, the gigabytes it leaves in ~/Library/Developer (DerivedData, simulators, archives, device support), simulator runtimes, the Command Line Tools and the xcode-select path, then how to install only what you need again.

Download for macOS — free and open source

CleanMate Uninstaller on a Mac, listing apps with their size and last useCleanMate Uninstaller on a Mac, listing apps with their size and last use

Dragging Xcode to the Trash frees about 10 GB and leaves the rest: simulators, simulator runtimes, build products and device symbols that often weigh three or four times the app. This guide removes all of it, step by step, and says what to keep if you still build for Apple platforms. If you only want Xcode smaller, not gone, read Xcode using too much space instead.

Before you start: check whether you need the Command Line Tools (git, clang, make), which Homebrew and most developer tools use. You can remove Xcode and keep them; that is the most common setup for a Mac that no longer builds iOS apps.

1. Delete simulator runtimes while Xcode is still there

Simulator runtimes are 5 to 8 GB each and live outside Xcode, in a system location. Remove them with simctl first, because it ships with Xcode:

xcrun simctl runtime list
xcrun simctl runtime delete <runtime identifier>

Then remove the simulators themselves:

xcrun simctl shutdown all
xcrun simctl delete all

2. Remove Xcode.app

Quit Xcode, then move /Applications/Xcode.app to the Trash in Finder (you may be asked for your password). If you installed it from the App Store, deleting it from Launchpad works too. Beta versions are separate apps, such as Xcode-beta.app.

3. Remove what Xcode left in your Library

Almost everything else is in ~/Library/Developer. See the sizes first:

du -sh ~/Library/Developer/* 2>/dev/null | sort -h

When nothing in it is left to keep:

mv ~/Library/Developer ~/.Trash/

Moving it to the Trash keeps a way back until you empty it. A few more traces, all small:

ls -d ~/Library/Caches/com.apple.dt.Xcode ~/Library/Preferences/com.apple.dt.Xcode.plist \
      ~/Library/Saved\ Application\ State/com.apple.dt.Xcode.savedState 2>/dev/null

Move the ones that exist to the Trash too. Removing com.apple.dt.Xcode.plist resets Xcode’s settings and accounts if you install it again.

4. Remove or reset the Command Line Tools

First see what xcode-select points to:

xcode-select -p

If it still says /Applications/Xcode.app/Contents/Developer, point it back to the Command Line Tools, or tools like git complain about a missing developer directory:

sudo xcode-select --reset

To remove the Command Line Tools as well (about 2 to 5 GB):

sudo rm -r /Library/Developer/CommandLineTools
sudo xcode-select --reset

There is no uninstaller; deleting the folder is Apple’s documented way. After that, git and clang ask you to install the tools again the first time you use them. Homebrew needs them, so keep them if you use brew.

5. Check what is left

du -sh ~/Library/Developer /Library/Developer 2>/dev/null
pkgutil --pkgs | grep -i CLTools

The pkgutil lines are receipts, a few KB of records that macOS keeps; you can leave them. If a size is still large, look in /Library/Developer/CoreSimulator, where older runtimes downloaded before Xcode 14 may remain; delete them as in step 1 or move the folder to the Trash.

Install again, smaller

How CleanMate does it

CleanMate 1.12 for Mac (all macOS features) helps with the parts above that are files:

It does not remove the Command Line Tools or change xcode-select: do those with the commands in step 4.

FAQ

Will removing Xcode break Homebrew or git? Not if you keep the Command Line Tools and run sudo xcode-select --reset so they are used again.

Can I delete /Library/Developer/CommandLineTools while Xcode is installed? Yes. Xcode carries its own copy of the tools; xcode-select -p shows which copy is in use.

Do I lose my signing certificates? No. They are in your keychain, not in Xcode’s folders. Your projects are untouched too.

Looking for a Pearcleaner alternative that is still updated? See how CleanMate compares.

Skip the commands

Open source — star it on GitHub: CleanMate for macOS

How CleanMate decides what is safe to remove →