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
- Uninstall Xcode by following the steps outlined in this post Cleanly uninstall apps on your Mac.
- Drag and drop the
Developer
directory under~/Library
in the Bin. - Repeat the same step for the
/Library/Developer
directory as well.Note: The user
~/Library
is different from the system/Library
. - Restart your Mac compulsorily.
Freshly install Xcode:
- 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.
- Double-click the
.xip
file, extract theXcode.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
. - 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.