As a developer, I often need to completely clear application preferences to test my applications. So of course I wrote an AppleScript to do the job for me in Mavericks. Here it is:
-- Delete Preferences For Application
-- Version 1.0.0 2013-11-10
-- Bill Cheeseman
(*
Starting with Mavericks, application preferences may be cached in such a way that deleting a preferences file is not immediately effective. This script for OS X 10.9 Mavericks immediately removes any cached preferences for the chosen application and then deletes the preferences file or files. The script reports whether cached preferences were found and deleted before giving you the option to delete the preferences file or files. The application must not be running. Authentication with an administrator password is required.
*)
use scripting additions
choose application with title "Delete Preferences for Application" with prompt "Choose an application:" as alias
set info to (info for result)
set displayName to displayed name of info
if application displayName is running then
display alert "\"" & displayName & "\" is running." message "Preferences should not be deleted while the application is running. Quit application \"" & displayName & "\" and run this script again." buttons {"OK"} default button "OK"
else
set bundleID to bundle identifier of info
try
do shell script "defaults delete -app " & quoted form of displayName with administrator privileges
display alert "Cached preferences of \"" & displayName & "\" were deleted." message "You can now delete the preferences file." buttons {"Cancel", "Delete"} default button "Delete" cancel button "Cancel"
on error errMsg number errNum
if errNum is 1 then
display alert "\"" & displayName & "\" has no cached preferences." message "You can delete the preferences file." buttons {"Cancel", "Delete"} default button "Delete" cancel button "Cancel"
end if
end try
do shell script "rm -rf ~/Library/Preferences/" & bundleID & "*"
end if