How can I move /Library/Developer to an external disk?

Until Xcode 10 I was able to move the Xcode Library/Developer folder to an external drive using a symlink, in order to free up space on my main disk, like

ln -s /Volumes/*/Library/Developer /Users/*/Library/Developer

In Xcode 11, moving the Developer folder produces errors related to my .xib files, like

/Users/*project_directory*/objects/View.xib:1:1: Failed to find or create execution context for description '<IBCocoaTouchPlatformToolDescription: 0x7fbc697f2a20> System content for IBCocoaTouchFramework-ElevenAndLater <IBSimulatorDeviceTypeDescription: 0x7fbc68ecd0c0> deviceType=com.apple.CoreSimulator.SimDeviceType.iPhone-8'. These intermediate objects were non-nil: ( …

Restarting the CoreSimulatorService, which is often proposed as the solution for this kind of errors, doesn't work in this case.


Solution 1:

Well, might be a strech to call this an answer, but most of the stuff that requires hd space on a modern Xcode installation is located in your

$ ~/Library/Developer

directory (mostly simulator files), and within the Xcode app bundle itself, in my case Xcode alone needs 10 gigabyte plus around 6 gigabyte for the simulator files and only 1.3 gigabyte in /Library/Developer.

I also do some Flutter development, so that is another 10 gigabyte for the Android sdk and 4 gigabyte for the emulator files, plus a couple for Flutter itself.

All those directories have been symlinked or aliased and works just fine on an external drive. This is described in my answer regarding moving Xcode and friends to an SSD drive.

I also got some problems using brew when I moved the /Library/Developer stuff, so it's probably best to leave that wormhole alone and focus on moving the things that does take a lot of space. If you've already messed it up, just install the command line package again using the xcode-select command as described in my other post and go through those steps that fits your setup.

I save around 50 gigabyte ++ on the system drive by using this method with Xcode, the simulator and all, and I don't have the problem you mentioned in your question. I've been doing this for a couple of years now. So it IS possible, even if I can't pinpoint why it's not working for you.

If you update the question, documenting:

  • the file system in use on the external drive
  • mount options you use for mounting it
  • if you use FileVault or not on the system
  • have you tried repairing the permissions on your whole user directory while booting into recovery mode? (In the terminal)

I'd have a bit more to work with probably. But as of now I can't reproduce what you experience.

Also try using a good old "alias" for the developer directory, don't use the command line to make a symlink, just hold down the option and command keys while dragging the Developer directory back to where it used to be. Sometimes things work better with a symlink, but in other situations I've found aliases to be the only way...