I ran:

sudo launchctl unload -w /System/Library/LaunchDaemons/

by mistake, now my Mac does not boot... Any idea how to fix that?

OS version: Yosemite.

  • Thx for edit, version is Yosemite
    – Vincebzh
    Nov 21 '16 at 13:16
  • Are you able to boot into single-user mode (Cmd-S) or Safe mode (Shift)?
    – Bob
    Nov 21 '16 at 14:38
  • Single user only, I tried to do sudo launchctl load -w /System/Library/LaunchDaemons/ from there but it didn't help.
    – Vincebzh
    Nov 21 '16 at 14:43
  • Hmm. Okay, we're already in over my head :) Maybe have a look at this post?
    – Bob
    Nov 21 '16 at 15:07
  • Thx, that's it. Actually I'm trying to reinstall the system without deleting user data.... If I find a fix, I'll post there too.
    – Vincebzh
    Nov 21 '16 at 15:17

The command sudo launchctl unload -w /System/Library/LaunchDaemons/ will force-disable all launch daemons in /System/Library/LaunchDaemons/ and add respective entries in a disabled.plist. The command – entered accidentally – doesn't affect the "unforced" load state of a system daemon but overrides any existing state (loaded/unloaded). Removing the disabled.plist will restore an almost default system configuration – except those daemons or agents which have been forced to one of the two states in the initial configuration of the system or after the installation of a third-party app. This can be salvaged by either restoring the file from a backup or – partly – by copying a disabled.plist file from a similar system.

To get your system booting again you have to remove this special file in Recovery Mode.

  • Boot to Recovery Mode
  • Open Terminal in the menubar Utilities > Terminal
  • cd to /Volumes/NameOfMainSystemVolume/private/var/db/com.apple.xpc.launchd
    Replace NameOfMainSystemVolume by the name of your main volume (e.g. Macintosh\ HD)
  • list all files with ls -la. You will get a list containing ~20 files - all related to user IDs - and a large file disabled.plist (~10-15 KB)
  • remove the files with rm *.plist
  • Reboot, edit /private/var/db/com.apple.xpc.launchd/disabled.plist with sudo nano … and replace the existing content – probably some basic xml plist header and one or more daemon, which may have been added by the system while booting - by the following content:

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">

    This should be the default content of the file in Yosemite. If you had installed additional 3rd-party apps, it probably contained more daemons previously. E.g I had to remove a Little Snitch and a XQuartz related system daemon to get a somehow "default" disabled.plist.

  • Thx a lot, I was actually looking at that file right now. It worked :)
    – Vincebzh
    Nov 21 '16 at 15:49
  • @Vincebzh I will add the (more or less) default content of the file. Just a second
    – klanomath
    Nov 21 '16 at 15:50
  • @grgarside Re: your edit. sudo launchctl unload -w /System/Library/LaunchDaemons/ only writes to disabled.plist but not to the other (user related ie. 0;248;501;...) plists. AFAIR I tested this with the root user and fseventer!
    – klanomath
    Feb 8 '17 at 15:56
  • That's what I thought, but the OP of the linked duplicate is demanding otherwise: apple.stackexchange.com/questions/192878/…
    – grg
    Feb 8 '17 at 15:56

You must log in to answer this question.

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