Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

My Mac is running out of disk. I searched for large files and directories and found the directory /Applications/Xcode.app/Contents/Developer/Platforms takes about 20GB of my disk.

ls -l
total 0
drwxr-xr-x  10 root  wheel  320 Dec 18 14:37 AppleTVOS.platform
drwxr-xr-x   7 root  wheel  224 Dec 18 15:10 AppleTVSimulator.platform
drwxr-xr-x   8 root  wheel  256 Dec 18 14:44 MacOSX.platform
drwxr-xr-x  10 root  wheel  320 Dec 18 15:10 WatchOS.platform
drwxr-xr-x   7 root  wheel  224 Dec 18 15:10 WatchSimulator.platform
drwxr-xr-x  10 root  wheel  320 Dec 18 15:10 iPhoneOS.platform
drwxr-xr-x   8 root  wheel  256 Dec 18 15:10 iPhoneSimulator.platform

I looked at the names of the folders, which are seemingly simulator, aka virtual machine, for different Apple operating systems.

I am a stranger in Apple os development and share no interest in it. I only write c, java, python, html and all that with my Mac. Can I delete these unnecessary files? Or should I keep the MacOSX.platform at least?

You may want to search (google or whatever) for xcode reclaim disk space ... here is just one blog post (not mine): mjtsai.com/blog/2019/03/29/reclaiming-disk-space-from-xcode – DonMag Feb 6, 2020 at 17:27 I deleted all the platforms but I shouldn't have deleted at least the macOX platform, because now it's causing this issue apple.stackexchange.com/questions/415563/… – dcxst May 28, 2022 at 20:09

Yes you can delete platforms from this folder

but make sure that you remove a platform and the simulator, otherwise Xcode will refuse to restart after

Example for Ios watch : remove WatchOS.platform and also WatchSimulator.platform

Works, but ... if I delete MacOSX.platform, I get No macOS platform was found, but Xcode requires a macOS Platform. You may have an incomplete or damaged installation of Xcode.. And the application returns... I'd suggest to keep this platform at least – Christophe Vidal Jan 12 at 16:54

Don Mag advice is good.

I would not remove anything from the /Applications/Xcode.app folder as this could cause you issues running Xcode.

There is a folder in ~/Library/Developer though that stores downloaded version of the DeviceSupport for any version of iOS/tvOS/watchOS etc that you have been developing for. Every time an OS is updated another download appears in these folders and older version are not removed automatically.

Any of these can be removed as they will download again automatically the next time you build to an OS version. Though bear in mind the extra wait time needed on the first build of an uncache version.

I use an App from the App Store called 'DevCleaner' which allows me to select any DeviceSupport files, Archives (I tend to keep these) and Derived data. It's useful as it shows how much space each folder is taking up.

I select everything but the latest versions of the OSes I am developing for.

Hope that helps.

-1, goes in an unproductive tangent instead of answering the question. In my case, ~/Library/Developer/DeviceSupport contained barely anything, so DevCleaner was useless. But the Cache dir contained a handful of GB, which I deleted manually. Also, I followed the answer by @ArmenK and deleted ~15GB from the Platforms folder inside the Xcode bundle - which is what the questions asks. Note: Xcode still opens, but I can't certify how much it might suffer, since I only ever use the CLI tools for macOS itself. – hmijail Nov 22, 2020 at 3:01

You can delete all simulators inside platform folder. And you can delete all folder besides "developer" and ".plist" files inside any platform folder , such as: Xcode.app/Contents/Developer/Platforms/AppleTVOS.platform Be careful, if you delete developer folder or some ".plist" files in any platform folder, Xcode will not be able to open.

My experience with deleting unneeded platforms is that it's fine if you have disabled SIP. I don't use Xcode, but it seems to work (I've tried building an example Macos app). Command line tools like Clang have no issues.

Note that the change breaks Xcode signature (check with codesign --verify). This means it won't work when SIP (System Integrity Protection) is enabled:

> codesign --verify /Applications/Xcode.app/
/Applications/Xcode.app/: a sealed resource is missing or invalid

I suggest keeping at least MacOSX.platform because it's required for building programs for Mac OS itself.

XCODE_PLATFORMS=/Applications/Xcode.app/Contents/Developer/Platforms
rm -rf "${XCODE_PLATFORMS}/AppleTVOS.platform"
rm -rf "${XCODE_PLATFORMS}/AppleTVSimulator.platform"
rm -rf "${XCODE_PLATFORMS}/WatchOS.platform"
rm -rf "${XCODE_PLATFORMS}/WatchSimulator.platform"
rm -rf "${XCODE_PLATFORMS}/iPhoneOS.platform"
rm -rf "${XCODE_PLATFORMS}/iPhoneSimulator.platform"

After running the above, I have only these SDKs:

> xcodebuild -showsdks
macOS SDKs:
    DriverKit 19.0                  -sdk driverkit.macosx19.0
    macOS 10.15                     -sdk macosx10.15

Note that all platforms are restored with every Xcode update.

If you go to any one of these .platform folders, and under that go to:

Library/Developer/CoreSimulator/Profiles/Runtimes

and delete the file in there, as long as you don't use that simulator (in my case WatchOS), then it should be fine.

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.