问题
I've noticed on OSX, installation is frequently a drag and drop one file kinda deal. I assume that file is an archive of all the applications necessary bits and that the application runs directly from it. Where does the application store configuration data, particularly per user settings when there are multiple users? On Windows, this type of stuff might go in the registry under HKLU or HKLM, or in the Application Data folder for the user or for all users.
回答1:
In /Users/username/Library/Preferences. You also see some stuff being placed in /Users/username/Library/Application Support.
Both of these folders have corresponding global locations outside /Users, namely under /Library. These however seem to be used very little by applications as such, for obvious reasons.
The format of the preferences for OSX-native applications are usually .plist (property-list) files with a name given in reverse-domain name syntax. There is a standalone application called Property List Editor which allows you to view and edit such files. (I think it's part of the XCode/developer-tools download.) Of course there's nothing to prevent you from using your own preference storage system, and naturally applications that are mostly cross-platform will tend to do this, but the preferences should nevertheless be placed in the /Users/username/Library/Preferences directory.
Edit: If you're writing software for the Mac and you're using the Cocoa framework, then Apple has this document for the part of the Cocoa API that deals with storing and retrieving preference settings: User Defaults Programming
回答2:
Also
/Users/username/Library/Containers
and /Users/username/Library/Group Containers
are places to look for.
回答3:
As an addendum to harms' answer, I would note that, like the windows registry, OS X preferences are deliberately not deleted when the app is removed but, unlike the windows registry, preferences can migrate from machine to machine as you upgrade your Mac and use the "user migration" facility.
This can lead to surprising results such as installing "NeatoApp 2008" and discovering that it knows all the settings you chose for "NeatoApp 2003" even though the 2003 version was never installed on your current machine.
来源:https://stackoverflow.com/questions/410013/where-do-osx-applications-typically-store-user-configuration-data