Deleting plist file does not reset app on macOS 10.9+

99封情书 提交于 2019-11-28 03:11:58

On 10.9, the system is doing some more robust "caching" of preferences. After deleting the plist file, I fired up Activity Monitor and force-killed the "cfprefsd" process. Be careful: there are multiple processes with this name running and you only want to kill the one running under your own user; do not kill the one running as root.

Doing this seems to flush the preferences cache and on the next run of my app, I get a pristine start-from-scratch launch.

Edit: As reported below, using defaults delete [your bundle identifier] at the command line also appears to eliminate the caching issue. I've had mixed success with this.

I found out that killing the user process cfprefsd will reflush the cache, so your changes will be kept

killall -u $USER cfprefsd

Tom Andersen

In terminal:

defaults delete com.somecompany.someapp

BTW, I've just released a GUI app that may be more convenient than working with the defaults command:

http://www.tempel.org/PrefsEditor

It works practically the same as Xcode's plist editor, but affects the user's app preferences directly.

To delete all your prefs, you could open your prefs in my Prefs Editor, Select All, then delete them with the Backspace or Delete key, and they're instantly all gone.

However, for this particular task, using defaults delete might still be quicker, especially if you put the command into a text file ending in ".command", and make it executable (with chmod +x). Then you can double click it from the Finder to execute it.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!