Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

A simple location services program was working fine on my machine and suddenly stopped working. Upon further exploring the problem, I realized that some process has disabled location services in System Preferences » Security & Privacy » Privacy.

I checked Enable Location Services, but again it got disabled automatically.

After some research I found that it's not just my program, even built-in system functions are also failing because of this problem for example System Preferences » Date & Time » Time Zone failed to get the current location.

Every time I check Enable Location Services, I see the following error in the console logs:

16/10/12 11:23:15.636 AM [0x0-0x42042].com.apple.systempreferences: ERROR,Time,372059595.636,Function,"CLInternalSetLocationServicesEnabled",CLInternalSetLocationServicesEnabled failed
16/10/12 11:23:15.638 AM [0x0-0x42042].com.apple.systempreferences: STACK,Time,372059595.636,1   CoreLocation                        0x00007fff8f9957be CLInternalSetLocationServicesEnabled + 110

Notes:

  • WiFi is on
  • I didn't install iOS Simulator
  • I use Xcode Version 4.5 (4G182)
  • I use Boot Camp and made my MacBook Pro dual boot (Mac OS X Lion and Windows 7)
  • I do only Mac development but not iOS
share|improve this question
#!/bin/sh
launchctl unload /System/Library/LaunchDaemons/com.apple.locationd.plist

defaults write /System/Library/LaunchDaemons/com.apple.locationd Disabled -bool false 

then

launchctl load /System/Library/LaunchDaemons/com.apple.locationd.plist

exit 0
share|improve this answer
5  
I think your answer would benefit from a little explanation and proper formatting. – Sami Laine Apr 12 '14 at 8:25
    
While this may answer the question, it would be a better answer if you could provide some explanation why it does so. – DavidPostill Oct 26 '15 at 20:13
    
This answer actually doesn't solve the issue for me personally (I updated it to add code formatting only). This problem has been solved for me, using the solution I noted in my own submitted answer. – Jon L. Oct 26 '15 at 20:14

I'm encountering the same issue in OSX 10.11 (El Capitan).

I found this post (https://jamfnation.jamfsoftware.com/discussion.html?id=5336#responseChild65097). I ran the script within, and finally my Location Services were fixed.

#!/bin/bash

########################## SET SYSTEM TIME  ##################################################
#
# Written by Tim Kimpton
#
# using information from https://jamfnation.jamfsoftware.com/discussion.html?id=5336
#
# If the machine is 5 minutes out of the kdc the machine will not bind to the domain.
#
# This script does the folling to ensure the time is correct
#
# 1. Unload the launch daemon used for location services
#
# 2. Get the hardware UUID of the machine and put it in the location services db
#
# 3. Enable location services
#
# 4. Correct permissions on the database file used for location services
#
# 5. Set the time zone to update the time automatically
#
# 6. Set the network time to on
#
# For information see https://jamfnation.jamfsoftware.com/discussion.html?id=5336
###############################################################################################

######################### ENVIRONMENT VARIABLES #######################

# Get the Hardware UUID from system profiler
uuid=$(/usr/sbin/system_profiler SPHardwareDataType | grep "Hardware UUID" | cut -c22-57)

####################### DO NOT MODIFY BELOW THIS LINE #################

# Unload the launch daemon
/bin/launchctl unload /System/Library/LaunchDaemons/com.apple.locationd.plist

# Write the UUID to the hidden plist file and initialise it
/usr/bin/defaults write /var/db/locationd/Library/Preferences/ByHost/com.apple.locationd."$uuid" LocationServicesEnabled -int 1

# Enable Location Services
/usr/bin/defaults write /var/db/locationd/Library/Preferences/ByHost/com.apple.locationd.notbackedup."$uuid" LocationServicesEnabled -int 1

# Make sure the permissions on the database file is correct
/usr/sbin/chown -R _locationd:_locationd /var/db/locationd
/bin/launchctl load /System/Library/LaunchDaemons/com.apple.locationd.plist

# Set time zone to update automatically
/usr/bin/defaults write /Library/Preferences/com.apple.timezone.auto Active -bool true

# Set network time to on
/usr/sbin/systemsetup -setusingnetworktime on > /dev/null 2>&1

exit 0
share|improve this answer
    
The script by Tim Kimpton works if one runs as superuser. I.e. before running any of these shell commands make yourself first root or superuser in the shell. My location services are now enabled. – W. Tome Mar 27 at 21:08

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.