I am trying to enable Location Services for 10.10 systems via Casper but I cannot find any option with configuration profiles to enable it and the few scripts I have found online do not seem to enable location services.
Specifically I am trying to enable location services to allow for OS X to update the timezone based on the location of the system.
Below is one of the failed scripts I had attempted.
https://www.afp548.com/2013/07/30/enabling-location-services-programmatically/
Best answer by jhbush
@bthomas this has been working for me. I'm not sure where I picked it up from.
@bearzooka You're getting that error because the script is trying to unload that System Daemon. I'm not sure if that is a 10.12.4 thing. I was originally running this outside a user session over the loginwindow, but if it is a SIP thing, it shouldn't matter where it is being run from. You can still run the defaults write command, it just may not be applied until a reboot occurs. I'll test this and let you know what I find.
@gda Thanks for those commands, real slick! Using sudo to run as locationd and using -currentHost so folks don't need to fiddle with UUIDs or file ownership issues. Looking at a lot of the code out there, mine included, I can't believe I haven't grasped currentHost before this! Although I've found defaults in 10.12+ will automatically append the UUID when you write to a ByHost path... anyway the currentHost option needs to be declared immediately after the command and before the "action verb":
@sshort Please share how you got this to work in High Sierra and Mojave. Location services are now protected by SIP I get the following error: 2018-10-27 18:51:44.864 defaults[7230:223088] Could not write domain /var/db/locationd/Library/Preferences/ByHost/com.apple.locationd; exiting
Just to update, my above post... Writing to the plist as locationd does not work in in Mojave (sorry too many test laptops Despite the file being owned by locationd:_ locationd you indeed get the "Could not write domain" error
What's more and worse is that despite this it will allow you to write to the plist as root:
bash-3.2# ls -l /private/var/db/locationd/Library/Preferences/ByHost/com.apple.locationd*
-rw------- 1 root wheel 148 Oct 30 10:11 /private/var/db/locationd/Library/Preferences/ByHost/com.apple.locationd.57B6A0CC-1731-5A1B-A795-004AD89C0060.plist
-rw------- 1 root wheel 74 Oct 30 10:12 /private/var/db/locationd/Library/Preferences/ByHost/com.apple.locationd.notbackedup.57B6A0CC-1731-5A1B-A795-004AD89C0060.plist
The really really bad downside to this is that if you unlock the Privacy Preference pane and check "Enable Location Service" it is unable to write those changes to disk! Despite checking and unchecking those plists don't budge, and if you leave it checked and reboot, you'll find it unchecked when it comes back up. Even if you write 1 as the value, because of the file mode, locationd can't read the plist and the only way to fix the permissions is to reboot in Recovery, where you can change ownership back to locationd
Yeah... I hope they fix this in 10.14.1 prolly too late for a bug report... of course, this is just Apple forcing their hand to let users run as admins, which I am all for, treat adults like adults... of course Macs are in education and everyone being an admin is not always ideal. Having Date/Time and Location prefs in MDM would be the ideal way to manage this
Although the command stated by @sshort did enable Location Service for Mojave and High Sierra, it was not enabling it for the specific apps. Is there a way around to enable location services for a specific app like Safari etc since loading and unloading of locationd.plist is prevented by SIP ? Thanks.
We use 3 different kinds of cookies. You can choose which cookies you want to accept. We need basic cookies to make this site work, therefore these are the minimum you can select. Learn more about our cookies.