I wanted to remove applications from location services in the security and privacy settings on MaC OS X 10.8 Mountain Lion. (The apps were still listed even though they were uninstalled.) I found the post Remove application from Location Services in Security & Privacy on Mac OS X 10.7, and that got me going in the right direction. Here is the OS X 10.8.2 Mountain Lion equivalent that worked for me. The main difference is the location of the clients.plist file. I also wanted to provide a step-by-step process.
DISCLAIMER: This worked for me. Make sure you have a good backup of your system. This process includes making a backup of the clients.plist file, but one can never be too safe.
1. Start terminal and then sudo to a root shell
2. Go to /var/db/locationd
3. Make a backup of the clients.plist file
cp -p clients.plist clients.plist.save
4. Convert clients.plist to xml (editable format)
plutil -convert xml1 clients.plist
5. Use vi (vim) to edit the clients.plist file and remove the application.
The file will likely contain many application entries. Here is the format of a single application entry (Safari in this case). The entire entry needs to be deleted.
<key>com.apple.Safari</key> <dict> <key>Authorized</key> <true/> <key>BundleId</key> <string>com.apple.Safari</string> <key>Executable</key> <string>/Applications/Safari.app/Contents/MacOS/Safari</string> <key>LocationTimeStopped</key> <real>376348187.80421197</real> <key>Registered</key> <string>/Applications/Safari.app/Contents/MacOS/Safari</string> <key>RequirementString</key> <string>identifier "com.apple.Safari" and anchor apple</string> <key>Whitelisted</key> <false/> </dict>
6. Convert the clients.plist file back to binary
plutil -convert binary1 clients.plist
7. Restart locationd
If the apps are still there, do the process again, except restart locationd using kill -9 after determining the PID as follows. The PID is the second field in the ps output.
ps -ef | grep locationd | grep -v grep
205 427 1 0 6:31PM ?? 0:00.07 /usr/libexec/locationd
kill -9 427
I ran the process twice to remove one app at a time. The first time, killall was sufficient. The second time, it was not. I do not know why. It acted like locationd was keeping a cache and rebuilding clients.plist. I say this because the entries were added back to clients.plist after running killall — and even on a reboot. Whatever the root cause, using kill -9 solved the problem for me.
If things go badly, then copy back the original file and restart locationd.
cp -p clients.plist.save clients.plist
killall locationd (or the kill -9 method)
I hope this helps. Cheers!