Posted on 08-10-2017 01:19 PM
Hi Jamf Nation
I'm trying to programmatically enable the location service. I have done this so far:
#!/bin/bash
/usr/bin/defaults write "/var/db/locationd/Library/Preferences/ByHost/com.apple.locationd" LocationServicesEnabled -int 1
/usr/sbin/chown -R _locationd:_locationd "/var/db/locationd"
exit 0
As since macOS 10.12.2 SIP does not allow to reload the com.apple.locationd.plist LaunchDaemon a reboot is necessary. But it does not even work after a reboot. I do have enabled Wi-Fi.
Any ideas?
Posted on 08-10-2017 03:28 PM
Not sure why you’re having issues to be honest as I’ve not tested what you’re doing but if you want to reload launch daemons or agents without rebooting you should be able to do this in the command line as the root user and by running this;
launchctl unload -w /path/to/launchdaemon
Then to reload it:
launchctl load -w /path/to/launchdaemon
If you want to check a launch daemon is running then as the root user run this:
launchctl list
Hopefully that at least helps in some way.
Rob
Posted on 08-11-2017 04:46 AM
@anverhousseini The post below might help you out.
Posted on 08-11-2017 06:32 AM
Corrected link for @anverhousseini's post: Enable Location Services after imaging
Posted on 08-15-2017 04:01 AM
@r0blee It is not possible to reload LaunchDaemons which are protected by SIP since 10.12.2
@StoneMagnet Thank you, I already saw that thread, but this doesn't work anymore.
Posted on 08-15-2017 01:59 PM
@anverhousseini good shout. With the exception of the updatesettings launch daemon the rest are indeed protected in /System/Library/LaunchDaemons/