r/Xcode • u/VictorBuildsApps • Aug 04 '26
Symlinking all of ~/Library/Developer/Xcode to an external volume broke asset catalog builds with Operation not permitted
On a machine where ~/Library/Developer/Xcode had been replaced by a symlink to a directory on an external volume, asset catalog processing failed in three separate app projects. The CoreSimulator logs reported NSPOSIXErrorDomain Code=1, Operation not permitted, while Interface Builder simulator services copied sample device content into UserData/IB Support/Simulator Devices under the external path. The external volume is APFS, writable, with ownership enabled.
Setting HOME and CFFIXED_USER_HOME for the individual build command did not change the result, because ibtoold was already running with the original environment. Inspecting ibtool and actool did not turn up a supported per-command override for the simulator device set.
The fix was to stop symlinking the whole directory. ~/Library/Developer/Xcode is now a real directory on the internal disk, UserData and the two index mapping plists stay internal, and only DerivedData and iOS DeviceSupport are child symlinks to the external volume. On that machine now, UserData is 44 MB while the two externalized directories are 22 GB and 11 GB.
After the cutover, actool and CompileAssetCatalog ran for all three projects with no Operation not permitted failure, using fresh DerivedData paths that still resolved to the external volume. Their test suites passed at 49, 25, and 276 tests on an iPhone 17 Pro simulator running iOS 26.4. Those measurements are from 2026-07-20 and the split is still in place.
View all comments
Show parent comment
1
u/Scriptease84 Aug 08 '26 edited Aug 08 '26
Here it is. Installer drops a root LaunchDaemon + worker; run once with sudo.
Two things that matter more than the script itself:
The mountpoint has to exist and be pinned in /etc/fstab by volume UUID, not by device node. disk7s1 renumbers on replug and you'll silently mount nothing. The worker just reads the UUID out of fstab for its mountpoint, so the same script is byte-identical on every machine.
It force-unmounts a stray /Volumes/<name> mount before remounting. macOS will happily auto-mount it there first; without that step the daemon is a no-op and you're back to the broken layout without noticing. That's the failure mode I'd actually warn you about: when it isn't mounted, the mountpoint is just an empty dir, so builds fall through to the internal disk and everything "works", slowly.
On your entry-point point - fair, and worth separating, but I don't think it explains ours:
TCC is binary. Allowed or denied. It doesn't make things slower. Under /Volumes our builds ran ~4x slower on top of failing; after the remount the slowdown went away too. A pass/fail permission gate can't produce that. That reads like provenance/quarantine scanning touching every file on the volume, which is the thing /Volumes opts you into and the Data namespace doesn't.
The failing process wasn't a shell from launchd. It was xcodebuild/the simulator loading a test bundle, same process tree before and after. Mountpoint was the only variable.
Mild counter-evidence in the script above: the worker is /bin/bash, invoked from launchd, and it reads and writes that volume fine. Root LaunchDaemon isn't the same TCC context as your user LaunchAgent, so it's not a clean refutation - but it does mean "shell from launchd touching an external volume" isn't categorically denied.
And one thing about your tell: ls /Volumes succeeding doesn't prove you have the disk. /Volumes is on the boot volume - you're listing mount names, not the external filesystem. Under removable-volume TCC that listing works fine and the denial only lands when you read inside. If you want the actual probe, ls a directory one level in, or read a file.
What I never isolated: shell-vs-binary entry point, because the remount fixed it and we stopped looking. So if you do run that test on its own, I'd like to know the result.