iOSmacOS

Where Does NSUserDefaults Store Its Plist File?

UserDefaults persist as plist files in the app's Preferences folder, named by bundle identifier. Same API, same layout on iOS and Mac.

Last updated

NSUserDefaults looks like magic until you learn it is one plist file per app. The system writes changed defaults to a Preferences folder inside the app's container, using the bundle identifier as the filename. Mac apps keep it directly visible in Library, while iOS apps keep it in their sandbox.

Suite defaults for app groups live in the group container instead, which is the usual reason the obvious file looks empty. Search the group container when an app shares settings with widgets or extensions. Never hand edit the file while the app runs, since the in memory cache overwrites your edit on quit.

Where NSUserDefaults stores this, by platform

iOS
App Container/Library/Preferences/[bundle].plist

Per app container under the bundle identifier. Pull it from simulator builds or device backups, since production phones hide it. Group suites live in the shared group container instead.

macOS
~/Library/Preferences/[bundle].plist

Same bundle identifier naming, directly browsable. Sort by modification date after changing a setting to confirm you found the right file.

Frequently asked questions

How do I inspect a UserDefaults file?

Copy the plist to a Mac and open it with Xcode's property list editor or a plist viewer. The file is binary or XML plist, both readable with standard tools once copied out.

How do I reset all defaults for an app?

Delete the plist with the app closed to reset every default at once. The app recreates it with built in values on next launch. iCloud synced defaults repopulate from the cloud, so sign out first if you mean it.

Notice an outdated path? Let us know.