Inspecting UserDefaults on iOS Simulator: Where to Find the Plist File

Tablet-PC sized Smartphone showing lots of apps.

When developing iOS apps, UserDefaults is a simple and convenient way to store small pieces of data – like user settings, preferences, or app state – persistently across launches. It's part of the Foundation framework and allows you to save and retrieve values such as strings, numbers, booleans, and even dictionaries using a key-value system. During development, especially when debugging or testing, it can be helpful to directly access the underlying User Defaults file on the iOS Simulator. In this post, I'll show you how to locate and open that file.

Getting app container data location

First, we need to find the app container data location (aka. app data path). Therefore, we use Terminal and the xcrun command:

  • Open Terminal and type: xcrun simctl get_app_container booted my.bundle.identifier data
  • Open location in Finder: open $(xcrun simctl get_app_container booted my.bundle.identifier data)

Replace my.bundle.identifier with your bundle identifier defined in Xcode. This shows the app data container location in Terminal or opens Finder at this location.

booted reflects the device which is currently booted in Simulator. If no device is booted, the command will return an error message.

Getting app container shared data location

When working with App Groups (e.g. when sharing UserDefaults between multiple apps), you need to specify an App Group Identifier. The shared app container location can then be found using its group identifier:
xcrun simctl get_app_container booted my.bundle.identifier group.identifier (as set in Xcode under App Groups)

Xcode showing a project with the app group and bundle identifier being set

User Defaults file location

  • The User Defaults file resides inside the app data container in ./Library/Preferences
  • Command to open location in Finder: open $(xcrun simctl get_app_container booted my.bundle.identifier data)/Library/Preferences

User Defaults file location when using App Groups

  • The User Defaults file resides in the shared app data container in ./Library/Preferences
  • Command to open location in Finder: open $(xcrun simctl get_app_container booted my.bundle.identifier group.identifier)/Library/Preferences

Never miss a new post, subscribe to my mailing list and get notified about new blogposts.