sudo launchctl unload -w /System/Library/LaunchDaemons/
by mistake, now my Mac does not boot... Any idea how to fix that?
OS version: Yosemite.
Ask Different is a question and answer site for power users of Apple hardware and software. It only takes a minute to sign up.Sign up to join this community
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.
ls -la. You will get a list containing ~20 files - all related to user IDs - and a large file disabled.plist (~10-15 KB)
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"> <dict> <key>com.apple.ManagedClientAgent.enrollagent</key> <true/> <key>com.apple.ftpd</key> <true/> <key>com.apple.rpmuxd</key> <false/> <key>com.apple.usbmuxd</key> <false/> <key>com.apple.mrt</key> <false/> <key>com.apple.stackshot</key> <false/> <key>org.ntp.ntpd</key> <false/> <key>com.apple.pacemaker</key> <true/> </dict> </plist>
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.