为了在我(M1,2020)MacBook Pro(MyD82LL/A)的内部驱动器上保存一些珍贵的256GB磁盘空间,我在安装Xcode后在MacOS终端中运行以下命令,以移动所有空间 - 当我格式化时,我将组件放在2TB外部驱动器上:
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
尽管绝对可以确保CoreSimulator文件夹具有正确的所有权和权限(因此, sudo> sudo chown -r $ user:saffers /obolums /obolumes /oblumes /obolumes /开发人员/coreSimulator
),我在尝试模拟设备时仍会遇到此错误(由于2880x1800 retina retina分辨率将屏幕截图的文件大小推到2MB上):

使它更加奇怪,我尝试了XCode,同时还可以在单独的终端窗口中运行 tail> tail> tail> tail> tail> tail> tail> tail> tail> tail> tail> tail> tail>。鉴于我确定(通过 chown
),我已经写了对移动目录的访问权限的事实似乎无视逻辑:
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.}
注意各种“您不知道有权保存文件“错误,尽管已经使用了 chown -r
在目录移动以试图纠正可能引起的任何权限问题之后。那么这里还有什么问题?
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 2880x1800 Retina resolution pushes the file size of the screenshot past 2MB):

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)
在这个答案的帮助下,我能够为此找到解决方法
https://stackoverflow.com/a/a/58304540
问题是CoreSimulatorService服务需要完整的磁盘访问以在单独驱动器上创建文件的完整磁盘访问。要授予访问权限,您需要拖放
com.apple.coresimulator.coresimulatorservice.xpc
进入security&amp;隐私&gt;隐私&gt;系统首选项中的完整磁盘访问
。您不能使用 +图标,因为.xpc
文件将被灰色。对我来说,这是XPC文件的途径:
/library/developer/privateframeworks/coresimulator.framework/a/xpcservices/com.apple.coresimulator.coresimulatorator.xpc
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 ofSecurity & 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
我遇到了一个类似的问题,我解决了以下问题:关于此Mac&gt;存储&gt;管理&gt;开发人员并打开屏幕,删除所有缓存,然后应该很好地工作。
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.
无论如何,最终只是将所有模拟器的东西移回我的本地驱动器中,问题就消失了。不确定为什么Xcode何时不在系统驱动器上模拟器时抱怨。
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.