Skip to content
md
# Sandbox rsync.samba Deny File-Write-Create in Xcode Flutter Builds

## Problem
When building a Flutter iOS app in Xcode on macOS (especially macOS 14+ on Apple Silicon), you may encounter permission errors:

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


These errors occur due to sandbox restrictions in Xcode 15+ that conflict with Flutter's build process. Common triggers include:
- Recent macOS/Xcode updates
- CocoaPods dependencies
- Flutter's build scripts being blocked by sandbox policies

## Solutions

### Primary Fix: Disable Sandboxing in All Targets
1. Open your Flutter project in Xcode (`ios/Runner.xcworkspace`)
2. Select **Runner** in the project navigator
3. Go to **Build Settings** → search for `ENABLE_USER_SCRIPT_SANDBOXING`
4. Set this setting to **NO** for **ALL CONFIGURATIONS** (Debug/Release)
5. Expand the **Targets** section and repeat Step 4 for **every target**:
   - `Runner`
   - `Flutter Assemble*` 
   - Any extensions (e.g., notification services)

![Xcode sandbox setting location](https://i.sstatic.net/vqk8D.png)

:::warning CRITICAL
Must disable sandboxing for ALL targets (App + Extensions). Missing even one will cause failures:
![Multiple targets requiring sandbox disable](https://i.sstatic.net/Mpc1w.png)
:::

### Additional Steps for Persistent Issues
After changing sandbox settings:
```bash
flutter clean
cd ios
rm -rf Pods Podfile.lock
pod cache clean --all
pod install
cd ..

Clean DerivedData & Simulators

If errors persist:

  1. Close Xcode
  2. Run:
bash
rm -rf ~/Library/Developer/Xcode/DerivedData/*
xcrun simctl delete unavailable
  1. Reopen Xcode and rebuild

CocoaPods/xcodeproj Fix (Post-Oct 2024 Issues)

If errors started after late Oct 2024:

ruby
# In Gemfile
gem 'xcodeproj', '1.25.0'

Then run:

bash
bundle install
bundle exec pod install

Alternatively, update CocoaPods:

bash
gem install cocoapods -v '>=1.16.1'

Why this works

Recent xcodeproj gem updates auto-enable sandboxing. Downgrading prevents this behavior only in projects still using Xcode 15.

React Native Additional Step

For React Native projects, also check Pods project:

  1. Open Pods.xcodeproj
  2. Set ENABLE_USER_SCRIPT_SANDBOXING = NOPods project sandbox setting

When Downgrading Isn't Necessary

Avoid downgrading macOS/Xcode until verifying:

  • All targets have sandboxing disabled
  • DerivedData was cleared
  • CocoaPods was reset
  • Pods project inspected (React Native only)

Explanation

  • Xcode's new sandbox (rsync.samba) restricts where files can be created at build time
  • Flutter/Pods scripts require access outside the default sandbox paths
  • Solutions reduce security during builds but enable compilation
  • Apple may resolve this in future Xcode updates

Avoid These!

✘ Using chmod 777 on system directories
✘ Reinstalling macOS/Xcode before trying primary fix
✘ Downgrading Xcode version below 15