6

I'm trying to test the installation of an application which uses Location Services (Core Location) on Mac OS X 10.7.

At the moment, it never prompts me for permission to grant the application access to Location Services, because that bundle ID has already been granted permission in the past.

If I untick the box, it assumes I want to disable the application completely, and doesn't ask me again.

How do I remove an item from the Location Services to force it to ask me again?

tomtaylor
  • 183
  • 1
  • 8
  • Here is the OS X 10.8 / Mountain Lion equivalent: http://superuser.com/questions/526183/remove-applications-from-location-services-in-security-privacy-on-mac-os-x-10 – Scot S Dec 31 '12 at 02:11

1 Answers1

7

Open a root shell in Terminal, and go to /var/folders/zz/. Run ls -l and enter the directory owned by _locationd.

Open the C subdirectory, and run the following command to convert the preferences file from binary to XML:

plutil -convert xml1 clients.plist

Now edit the file e.g. in vim from the command line, removing the application (both key and dict afterwards) you no longer want to have appear on the list.

Save, and killall locationd to have it reload from the settings file.


Chances are, that the PromptedSettings key is useful as well, if no authorization is given, but I leave figuring this out to the reader.

Daniel Beck
  • 109,300
  • 14
  • 287
  • 334
  • This seems to have got my current app into a bit of a pickle. Now it throws a long stack trace when initializing Core Location, even though [CLLocationManager locationServicesEnabled] returns YES. Is there another location where this might be cached? – tomtaylor May 27 '12 at 18:27
  • Ignore my last comment, this was an unrelated bug with sandboxing. – tomtaylor Jun 13 '12 at 09:13
  • @tomtaylor Sandboxing *is* the bug. – Daniel Beck Jun 13 '12 at 18:00
  • @tomtaylor: I'm having exactly the same problem with sandboxing. How did you work around it? – sudo rm -rf Jun 30 '12 at 14:28
  • @sudorm-rf: Apple confirmed it's a bug in 10.7.4, fixed in 10.8. Hopefully patched in 10.7.5 too, but I've not checked. – tomtaylor Jul 19 '12 at 14:36
  • @tomtaylor: I submitted a radar about it and it was marked as dupe. I was about to use one of my support incidents on it. Would you say that would be a waste? – sudo rm -rf Jul 19 '12 at 14:42
  • Thanks for this, saved me tearing my hair out with messed up preferences. I've also found that it's sometimes necessary to manually edit an entry's `Authorized` key to enable/disable it. The checkboxes don't seem to stick always. – robmathers Aug 21 '12 at 22:14
  • What do you mean by "killall locationd" ? When I write it in Terminal, I get : "No matching processes belonging to you were found". Thanks. – toto_tata Dec 21 '12 at 14:10
  • I removed the key relative to my app from the dictionary but now I have some bugs... 1) I have got a discrepency between the clients.plist file and what is displayed in my preferences: I no longer have my app in the plist (I removed it) but it is still displayed in the preferences 2) Even if I clicked on the alert to allow the location services, the key is not back to my clients.plist 3) My app is no longer able to determine my location even if [CLLocationManager locationServicesEnabled] always returns YES => always get didFailWithError – toto_tata Dec 21 '12 at 14:59
  • 4) If I allow or forbid the location services for my app in the user preferences, the result is the same: the location is not determined. Anybody can help me ? By the way, what do you mean with this sandboxing bug ? – toto_tata Dec 21 '12 at 14:59
  • Actually, the behaviour of all these stuffs became completely cahotic... 1) Sometimes I get the startup alert, sometimes not 2) the list of apps using location services sometimes displays all my apps using location services, sometimes is empty... 3) In all cases, the clients.plist is never modified ! Any idea ? – toto_tata Dec 21 '12 at 15:13
  • @Regis_AG Are you really on OS X 10.7, for which both the question and answer were written? – Daniel Beck Dec 21 '12 at 16:37
  • I am on OSX 10.7.5. Thanks for your support... It is a nightmare ! – toto_tata Dec 21 '12 at 17:12
  • @Regis_AG I'm using OS X 10.8 so I cannot investigate -- maybe it's named `_locationd` on your system as on 10.8? Run `ps aux | grep location` and see what the result is. Kill it. – Daniel Beck Dec 21 '12 at 17:24
  • I am going to try what you are saying. Actuallt I am wondering if the problem is not due to the fact that I could not access the "C" folder and I executed the following command : sudo chown -R my_name: "c" Can this change in the permissions have an influence ? If yes, what can I type to repair my mistake ? Thanks! – toto_tata Dec 21 '12 at 17:39
  • @Regis_AG You started out wrong -- read the first four words of my answer again. Then you can `chown _locationd`, that's an internal system user. – Daniel Beck Dec 21 '12 at 17:45
  • Thanks for your help Daniel, I really appreciate. I understand that I would not have had to change the rights if I ran Terminal in root mode with sudo -s ; correct? Here is the result of ps aux | grep location (I really don't know what this means :)): "myname 2036 0,0 0,0 2425480 200 s000 R+ 6:52 0:00.00 grep location" What do you conclude about this? What should I do? What do you mean by "kill it" ? What do you mean by "Then you can chown _locationd"? Sorry but I am a newbie with Terminal... Thanks again!! – toto_tata Dec 21 '12 at 17:59
  • @Regis_AG This just means that the location service on your system is not currently running. Chances are, your permission change broke it. Revert that, restart the system, try again. – Daniel Beck Dec 21 '12 at 18:06
  • I restarted my system once more and still not works. Does "myname 2036 0,0 0,0 2425480 200 s000 R+ 6:52 0:00.00 grep location" mean that the location service of my system doesn't work ? It is indeed the feeling I have got ! Here are the permissions of the "C" folder: "drwx------ 10 myname _locationd 340 21 déc 17:01 c" Do you see anything wrong? Thanks!!! – toto_tata Dec 21 '12 at 18:23
  • Here is the permission on the "C" folder on backup of my disk: "drwxr-xr-x 5 myname staff 170 20 sep 23:58" ('ls -ld c' command) It seems that some permissions are lacking on the folder on my computer (previous post)... Tell me what you think about that. Thanks again. – toto_tata Dec 21 '12 at 18:34
  • 1
    @Regis_AG Again, just `chown -R _locationd C` to revert what you broke earlier, and it should work again. – Daniel Beck Dec 21 '12 at 20:01
  • Thaaannnnnkssss !!!!!!!!!!!! It works again !!!! YOU ARE A GENIUS !! :) What I did (for those who could have the same the same problem as me: 1) sudo -s (to be in Terminal root mode) 2) chown -R _locationd C 3) Restart my computer And it works ! For my culture, what does 'chown -R _locationd C' do ? How did you know that I had to type that ? If you come to Paris, I will pay you (at least) a pint of beer ! I really thought that my Mac was broken :( Thanks !!! – toto_tata Dec 21 '12 at 23:57
  • (ChangeOwner -Recursive Username Directory) it recursively changed the ownership of all directories and files including C, to be owned by user _locationd – Nevin Williams Apr 12 '13 at 23:33