skip to Main Content

In order to save some of the precious 256GB of disk space on the internal drive of my (M1, 2020) MacBook Pro (MYD82LL/A) I ran the following commands in my macOS Terminal after installing Xcode in order to move all the space-hogging components to a 2TB external drive that I named "Developer" when I formatted it:

sudo mv /Applications/Xcode.app /Volumes/Developer/Applications/Xcode.app && sudo ln -s /Volumes/Developer/Applications/Xcode.app /Applications/Xcode.app
sudo mv ~/Library/Developer/CoreSimulator /Volumes/Developer/CoreSimulator && ln -s /Volumes/Developer/CoreSimulator ~/Library/Developer/CoreSimulator && sudo chown -R $USER:staff /Volumes/Developer/CoreSimulator

Despite making absolutely certain to ensure that the CoreSimulator folder has the correct ownership and permissions (hence sudo chown -R $USER:staff /Volumes/Developer/CoreSimulator above), I’m still getting this error on attempt to simulate a device (image downscaled because the 2880×1800 Retina resolution pushes the file size of the screenshot past 2MB):

downscaled screenshot of error message

Making this even more strange, I attempted this from Xcode while also running tail -f ~/Library/Logs/CoreSimulator/CoreSimulator.log in a separate terminal window. The resulting real-time log information seems to defy logic in light of the fact that I made sure (via chown) that I already had write access to the moved directory:

May  3 13:27:12 realkstrawn93-m1mbp CoreSimulatorService[2890] <Warning>: Device BC4197AA-A5E9-4611-98B3-4C96B2CCD460 encountered in creation state at launch.  The device will be re-created.
May  3 13:27:12 realkstrawn93-m1mbp CoreSimulatorService[2890] <Error>: Error copying sample content to path /Volumes/Developer/CoreSimulator/Devices/BC4197AA-A5E9-4611-98B3-4C96B2CCD460/data : Error Domain=NSCocoaErrorDomain Code=513 "You don’t have permission to save the file “BC4197AA-A5E9-4611-98B3-4C96B2CCD460” in the folder “Devices”." UserInfo={NSFilePath=/Volumes/Developer/CoreSimulator/Devices/BC4197AA-A5E9-4611-98B3-4C96B2CCD460, NSUnderlyingError=0x6000000000c0 {Error Domain=NSPOSIXErrorDomain Code=1 "Operation not permitted"}}
May  3 13:27:12 realkstrawn93-m1mbp CoreSimulatorService[2890] <Error>: Error Domain=NSCocoaErrorDomain Code=513 "You don’t have permission to save the file “BC4197AA-A5E9-4611-98B3-4C96B2CCD460” in the folder “Devices”." UserInfo={NSFilePath=/Volumes/Developer/CoreSimulator/Devices/BC4197AA-A5E9-4611-98B3-4C96B2CCD460, NSUnderlyingError=0x6000000000c0 {Error Domain=NSPOSIXErrorDomain Code=1 "Operation not permitted"}}
May  3 13:27:12 realkstrawn93-m1mbp CoreSimulatorService[2890] <Error>: Failed to re-create device that was encountered in the creation state (realkstrawn93-ip13sim (BC4197AA-A5E9-4611-98B3-4C96B2CCD460, iOS 15.4, Creating)): Error Domain=NSCocoaErrorDomain Code=513 "You don’t have permission to save the file “BC4197AA-A5E9-4611-98B3-4C96B2CCD460” in the folder “Devices”." UserInfo={NSFilePath=/Volumes/Developer/CoreSimulator/Devices/BC4197AA-A5E9-4611-98B3-4C96B2CCD460, NSUnderlyingError=0x6000000000c0 {Error Domain=NSPOSIXErrorDomain Code=1 "Operation not permitted"}}
May  3 13:27:12 realkstrawn93-m1mbp CoreSimulatorService[2890] <Error>: New device is stuck in creation state, deleting: realkstrawn93-ip13sim (BC4197AA-A5E9-4611-98B3-4C96B2CCD460, iOS 15.4, Creating)
May  3 13:27:12 realkstrawn93-m1mbp CoreSimulatorService[2890] <Error>: Error Domain=NSPOSIXErrorDomain Code=22 "Invalid argument" UserInfo={NSLocalizedFailureReason=Device was allocated but was stuck in creation state.  Check CoreSimulator.log for more information.}
May  3 13:27:12 realkstrawn93-m1mbp CoreSimulatorService[2890] <Error>: Error Domain=NSPOSIXErrorDomain Code=22 "Invalid argument" UserInfo={NSLocalizedFailureReason=Device was allocated but was stuck in creation state.  Check CoreSimulator.log for more information.}
May  3 13:27:12 realkstrawn93-m1mbp com.apple.dt.Xcode[24690] <Error>: ERROR creating device: Error Domain=NSPOSIXErrorDomain Code=22 "Invalid argument" UserInfo={NSLocalizedFailureReason=Device was allocated but was stuck in creation state.  Check CoreSimulator.log for more information.}
May  3 13:27:12 realkstrawn93-m1mbp com.apple.dt.Xcode[24690] <Error>: Error Domain=NSPOSIXErrorDomain Code=22 "Invalid argument" UserInfo={NSLocalizedFailureReason=Device was allocated but was stuck in creation state.  Check CoreSimulator.log for more information.}

Note the various "You don’t have permission to save the file" errors despite having already used chown -R after the directory move to attempt to rectify any permissions issues that may arise from such. So what else could possibly be wrong here?

3

Answers


  1. Chosen as BEST ANSWER

    Ended up simply moving all the simulator stuff back onto my local drive anyway and the problem disappeared. Not sure why Xcode complains when the simulators aren’t on the system drive though.


  2. I was able to find a workaround for this with the help of this answer
    https://stackoverflow.com/a/58304540

    The problem is that CoreSimulatorService needs full disk access to create files on a separate drive. To grant access you need to drag and drop com.apple.CoreSimulator.CoreSimulatorService.xpc into the apps area of Security & Privacy > Privacy > Full Disk Access in System Preferences. You can’t use the + icon because .xpc files will be grayed out.

    For me, this was the path to the xpc file:
    /Library/Developer/PrivateFrameworks/CoreSimulator.framework/Versions/A/XPCServices/com.apple.CoreSimulator.CoreSimulatorService.xpc

    Login or Signup to reply.
  3. I met a similar issue, and I solved like below: About this Mac > Storage > Manage > Developer and Open the screen, delete all cache, then it should work well.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search