Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages
Flutter and app store releases

Xcode build fails with Sandbox: rsync.samba deny(1) file-write-create

ErrorSandbox: rsync.samba (13105) deny(1) file-write-create

Short answer

Xcode runs script build phases inside a sandbox, and a pod or framework script that runs rsync is blocked from writing into the app. First read the real value of ENABLE_USER_SCRIPT_SANDBOXING in the build log. If it is YES in any target, including Pods, set it to NO.

  • Applies to Xcode 15 and later, CocoaPods, Flutter 3.x stable
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Fix it fast

  1. 1Find out which cause you have

    Make the script phase print its settings. Select the failing Run Script phase in the target's Build Phases, enable Show environment variables in build log, build again, and read the value of ENABLE_USER_SCRIPT_SANDBOXING in the log.

    xcodebuild -workspace ios/Runner.xcworkspace -scheme Runner -showBuildSettings | grep ENABLE_USER_SCRIPT_SANDBOXING
  2. 2Match what you see, then jump to its fix

    1. 1The log shows ENABLE_USER_SCRIPT_SANDBOXING = YESScript sandboxing is still on in some targetFix
    2. 2The log shows ENABLE_USER_SCRIPT_SANDBOXING = NO and the same error appearsIt is already NO, but a dependency's script still needs rsyncFix

What does the error look like?

  • Sandbox: rsync.samba (13105) deny(1) file-write-create
  • Flutter failed to write to a file

Cause 1 of 2

Script sandboxing is still on in some target

1Check

The value can come from the Runner project, the Runner target or the Pods project, which has its own targets. Setting it in only one place can leave it enabled in another.

xcodebuild -workspace ios/Runner.xcworkspace -scheme Runner -showBuildSettings | grep ENABLE_USER_SCRIPT_SANDBOXING

2Fix

In Xcode, search Build Settings for User Script Sandboxing and set it to No in each place that still shows Yes, including the Pods project, then clean and build.

# Xcode: select the project or target > Build Settings
# search "User Script Sandboxing" > set No (Pods project included)
# then read the value again:
xcodebuild -workspace ios/Runner.xcworkspace -scheme Runner -showBuildSettings | grep ENABLE_USER_SCRIPT_SANDBOXING

3Verify

Clean the build folder and rebuild.

flutter clean && flutter build ios --no-codesign

Confirmed by developer.apple.com

Did this fix it?

Cause 2 of 2

It is already NO, but a dependency's script still needs rsync

1Check

An Apple DTS engineer says to look at what the dependency's own script does when the setting is already NO, because it still depends on rsync.

grep -n "rsync" ios/Pods/Target\ Support\ Files/*/*.sh | head

2Fix

Ask the vendor of that SDK for its integration requirements. Apple calls the sandbox the default and recommended setting, and suggests an integration that avoids build scripts, such as Swift Package Manager, if the vendor offers it.

# no command: follow the SDK vendor's current integration guide

3Verify

Build after updating the dependency to the vendor's current release.

flutter build ios --no-codesign

Confirmed by developer.apple.com

Did this fix it?

How do I stop it coming back?

  • Read an SDK vendor's integration notes before adding it, since some need script phases.
  • Re-check the setting after every Xcode upgrade.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.

Which stack is behind this page?

Projects of mine built on the same technologies:

Related fixes

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.