As Apple platform developers, we appreciate Xcode and the wonderful job it does, but we also acknowledge that it can be improved. I recall a German App Store review that stated,

Wunderbare Software, aber die Spezifikationen der Hardware liegen in der Zukunft. (Wonderful software, but the hardware specifications lie in the future.)

Occasionally, I need to clean install (reinstall) Xcode on my development machine and the Ci server. Even the hiring team values your troubleshooting skills with the Ci server and Xcode.

Here’s the approach I’ve been following for at least ten years, and it still works.

Uninstall the Xcode

  1. Uninstall Xcode by following the steps outlined in this post Cleanly uninstall apps on your Mac.
  2. Drag and drop the Developer directory under ~/Library in the Bin.
  3. Repeat the same step for the /Library/Developer directory as well.

    Note: The user ~/Library is different from the system /Library.

  4. Restart your Mac compulsorily.

Freshly install Xcode:

  1. Download your preferred Xcode version from https://developer.apple.com.

    Note: Downloading Xcode from the App Store can be slow, even with a 1Gbps fiber connection.

  2. Double-click the .xip file, extract the Xcode.app, and move it to the Applications directory.

    Tip: It is usually beneficial to keep the version information in the filename, such as Xcode-15.3.

  3. Finally, install the required iOS and/or macOS SDKs as you need.

Conclusion

I purposely avoided using terminal commands to achieve the goal because they did not work as expected on several occasions.