I mistakenly disabled all services in Yosemite (10.10), now it can't boot 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.
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:

&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"&gt;
&lt;plist version="1.0"&gt;
&lt;dict&gt;
    &lt;key&gt;com.apple.ManagedClientAgent.enrollagent&lt;/key&gt;
    &lt;true/&gt;
    &lt;key&gt;com.apple.ftpd&lt;/key&gt;
    &lt;true/&gt;
    &lt;key&gt;com.apple.rpmuxd&lt;/key&gt;
    &lt;false/&gt;
    &lt;key&gt;com.apple.usbmuxd&lt;/key&gt;
    &lt;false/&gt;
    &lt;key&gt;com.apple.mrt&lt;/key&gt;
    &lt;false/&gt;
    &lt;key&gt;com.apple.stackshot&lt;/key&gt;
    &lt;false/&gt;
    &lt;key&gt;org.ntp.ntpd&lt;/key&gt;
    &lt;false/&gt;
    &lt;key&gt;com.apple.pacemaker&lt;/key&gt;
    &lt;true/&gt;
&lt;/dict&gt;
&lt;/plist&gt;


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.