Friday, 27 September 2019

macos - Remove Applications from Location Services in Security & Privacy on Mac OS X 10.8

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
sudo -s


2. Go to /var/db/locationd
cd /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.
vi clients.plist


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.


    com.apple.Safari

Authorized

BundleId
com.apple.Safari
Executable
/Applications/Safari.app/Contents/MacOS/Safari
LocationTimeStopped
376348187.80421197
Registered
/Applications/Safari.app/Contents/MacOS/Safari
RequirementString
identifier "com.apple.Safari" and anchor apple
Whitelisted



6. Convert the clients.plist file back to binary
plutil -convert binary1 clients.plist


7. Restart locationd
killall 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
Output: 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!

No comments:

Post a Comment

How can I VLOOKUP in multiple Excel documents?

I am trying to VLOOKUP reference data with around 400 seperate Excel files. Is it possible to do this in a quick way rather than doing it m...