4

This question already has an answer here:

While trying to set up some services (OS X 10.10 Yosemite), I accidentally did a sudo launchctl unload -w /System/Library/LaunchDaemons/ and the screen was frozen immediately. Now my Mac doesn't boot any more. The loading bar is half full, and nothing happens.

Is there a way to restore the daemons with some kind of rescue console? Unfortunately, I don't have a working time machine backup, my external hard drive crashed some days ago.

I can still boot into recovery mode, using Cmd+R while booting. I can also access the terminal. I tried a launchctl load -w /System/Library/LaunchDaemons/ but it said ‘Operation already in progress’ for every process.

When trying to load the LaunchDaemons files, I was on the rescue partition. After switching to /Volumes/Macintosh HD/System/Library/LaunchDaemons/ and doing a launchctl load -w /Volumes/Macintosh HD/System/Library/LaunchDaemons/ I got some errors with File already exists, but some other Daemons seem to load.

But I suspect, that they are loaded into the rescue system. So I also tried to use the launchctl file of /Volumes/Macintosh HD/bin/launchctl. But unfortantely, same result, the screen stucks with a half progress bar during startup.

I had a look into the verbose startup (pressing Cmd+V at startup). The last lines, where everything stops are

hfs: mounted Macintosh HD on device root_device
XCPM: registered
VM Swap Subsystem is ON
Darwin Bootstrapper Version 2.0.2: Mon Mar....
boot-args = -v
** /dev/rdisk1 (NO WRITE)
** Root file system
   Executing fsck_hfs (versoin hfs-285)
Warning: couldn't block sleep during cache update
Warning: proceeding w/o DiskArb
/dev/disk1 on / (hfs, local, journaled)
BootCacheControl: Unable to open /var/db/BootCache.playlist: 2 No such file or directory
Bash: /etc/rc.server: No such file or directory
USBMSC Identifier (non-unique): 0000000...
bash: /etc/rc.installer_cleanup: No such file or directory
AppleUSBMiltitouchDriver::checkStatus - received Status Packet, Payload 2: device was reinitialized

I also tried to reinstall Yosemite over my old system (without deleting the filesystem, so my data is still there). Unfortunately, the problem stays the same.

Now I can log in in single-user mode (I had to press an additional Enter). After that, I set the filesystem to read with mount -uw /. Then I load all the daemons with launchctl load -w /System/Library/LaunchDaemons. And then, surprise it loads my Mac's login screen, and I can login.

But when I try to restart, I have to repeat that step to login (which is kinda annoying…). I also tried to load all daemons with launchctl load -w /System/Library/LaunchDaemons when I'm logged in.

Here I get ‘Operation already in progress’. I read something in the single-user mode that the loading of services is not supported. Does this affect the fully loaded OS X too? I'm not sure if I'm still in single-user mode or not. How can I tell OS X to load all the LaunchDaemons on startup?

marked as duplicate by klanomath, Tetsujin, grg macos Feb 8 '17 at 13:49

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • You might give single user mode or safe mode a shot… – Dustin Wheeler Jun 24 '15 at 12:23
  • I already tried both, but it doesn't help – 23tux Jun 24 '15 at 12:24
  • 1
    I'm at a system running OS X 10.8.5 so just as an example there are 237 .plist files in /System/Library/LaunchDaemons. 50 of them are (probably by default) disabled and only 42 of them are set to RunAtLoad. So, I'm not sure it's a good idea to be issuing a blanket launchctl load ... command on the entire directory. BTW The numbers presented are for the text based .plist files. There are a handful, 5, of binary .plist files and I did not check the values on those. – user3439894 Jun 24 '15 at 15:52
  • 1
    Reading man launchctl and more specifically the load subcommand with the -w option is says"Overrides the Disabled key and sets it to false. In previous versions, this option would modify the configuration file. Now the state of the Disabled key is stored elsewhere on-disk." and with that last portion it doesn't state were elsewhere on-disk is. Along with other info in the man page and if I was in this situation I'd bite the bullet and backup my Home Folder and do a wipe install from USB thumb drive and count it as a hard lesson learned. – user3439894 Jun 24 '15 at 16:09
  • 1
    Had the same problem , an answer has been found: apple.stackexchange.com/questions/261827/… – Vincebzh Nov 21 '16 at 15:51
3

for a persistent fix you can login to single user mode, then mount -uw /, and then delete the launchctl override database. I'm not sure for Yosemite, but on Sierra that would be rm /var/db/com.apple.xpc.launchd/*.plist. after that you can just exit or reboot. this is not as a sledgehammer as it seems. the system re-enableds some of its overrides (from various other configuration files i guess) and so you actually get a nice and fresh override db without masses of "disabled: false".

  • I lived with my own workaround for quite a while now, but your answer solved ist perfectly! I did it before I upgraded to Sierra, and everythink works fine! – 23tux Feb 8 '17 at 9:33

Not the answer you're looking for? Browse other questions tagged .