Mac – How to completely uninstall Xcode in macOS Mojave 10.14

homebrewmac-appstorexcode

After upgrading to macOS Mojave 10.14, Xcode was no longer updating correctly and my build process was reporting that stdlib.h was missing. Thus, I attempted to uninstall it so I could reinstall it after.

However, after removing it via the (x) button displayed on the Xcode app icon in Launchpad, the app was still in /Applications directory. So I deleted it from there as well.

However, the Mac App Store is still showing the option to update Xcode as if it were installed (and clicking the button resulted in a loading animation being displayed for half a second and then the update button again). I have also removed all the various folder listed here:

as well as followed the instructions to empty the Mac App Store cache provided here:

and here:

So far, nothing has changed the fact that the Mac App Store thinks I should update instead of install.

Is there anything else to do to get the Mac App Store to reinstall Xcode?

If it's easier, I'd be content with installing LLVM via Homebrew without messing things up. I don't really need Xcode itself, only the build tools.

xcode-select --install behaves similarly to the Mac App Store (namely claiming the tools are already installed or producing a non-working installation if I remove the CommandLineTools directories in the different Libraries).

EDIT: after some more back-and-forth I managed to get the Command Line Tools working via xcode-select --install. However, I'm still left with the update notification for Xcode in the Mac App Store.

Best Answer

What finally solved the problem for me was to download and install the Command Line Tools as well as Xcode (in that order) from the Apple developer site. After the next reboot, the Mac App Store recognised Xcode as not installed and all standard libraries and compilers were available again (which was not quite the case with Command Line Tools only).