I’ve been doing some iOS development with new Device Hub simulator in Xcode 27 and ran into what seems like it should be a really simple problem – copying the file from my Mac to the simulator.
With the older Simulator app I could just drag something like a JSON or CSV file from Finder onto simulator. It would show up in the Files app and I could select it using my app’s file picker.
That doesn’t seem to work with the simulator running inside the new Device Hub. Found a few hints on Google search, and eventually got a working combination to do it with simctl and rsync.
Copying It Somewhere Doesn’t Seem to Be Enough
Since the simulator’s filesystem is sitting right there on the Mac under:
~/Library/Developer/CoreSimulator/Devices/
My first thought was basically well I’ll find the right simulated Downloads directory and copy the file there. I think maybe did that long ago before figured out the drag and drop option.
I could copy my JSON file there, run ls, and see the file was there. Unfortunately the Files app couldn’t see it and neither did file picker in my application. No, restarting the simulated phone didn’t seem to make help.
Finding the Storage Used by Files
What finally worked for me was using the shared container associated with the Files app. This was a detail I found in a forum post.
First find the simulator you’re currently running:
xcrun simctl list | grep Booted
That gives you something similar to:
iPhone 17 Pro (XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX) (Booted)
Take that device ID and ask simctl for the Files application’s group containers:
xcrun simctl get_app_container <DEVICE-ID> com.apple.DocumentsApp groups
You’ll get several entries back. The interesting one for this purpose is:
group.com.apple.FileProvider.LocalStorage
The path next to that appears to be the local storage used for files app “on my iPhone”.
Inside that directory is another directory named:
File Provider Storage
Copying my file there (with rsync) finally made it show up in the Files app.
The Slightly Weird Part
I originally tried copying the file using cp. That didn’t work correctly for me. In some of my testing I ended up with a zero-byte or unusable file. Maybe user error, I’m not sure.
Using rsync instead worked:
rsync -av my-file.json "<LocalStorage path>/File Provider Storage/my-file.json"
After doing that I could open Files on the simulator, select “on my iPhone”, and there was my file. No idea why and didn’t even Google it to see.
Making It Less Annoying
Great quick and easy use of Claude Code agent, create a script! Here’s a small script that finds the Files app’s LocalStorage container on the currently booted simulator and copies whatever file you give it. I didn’t test it with multiple simulators running.
#!/bin/bash
if [ "$#" -eq 0 ]; then
echo "Usage: simfile <file> [file...]"
exit 1
fi
LOCAL_STORAGE=$(
xcrun simctl get_app_container booted com.apple.DocumentsApp groups |
sed -n 's/^group\.com\.apple\.FileProvider\.LocalStorage[[:space:]]*//p' |
head -1
)
if [ -z "$LOCAL_STORAGE" ]; then
echo "Could not find the simulator LocalStorage container."
echo "Make sure a simulator is booted."
exit 1
fi
DEST="$LOCAL_STORAGE/File Provider Storage"
echo "Copying to:"
echo "$DEST"
echo
rsync -av -- "$@" "$DEST/"
Save it as simfile, make it executable:
chmod +x simfile
and then:
./simfile ~/Downloads/test-data.json
After executing it file should then be sitting under “On my iPhone” in the simulator’s Files app. Restart the simulator if you don’t see the update.
Good Enough for Now
There may be a cleaner (or official and proper way) to do arbitrary file transfers with Device Hub that I’ve missed!
