Restoring Yosemite server after unloading launch daemons So, while trying to fix a corrupt open directory I came across a fix that said to enter this command...

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

org.openldap.slapd.plist


From the formatting I thought these were two separate commands but in fact they were one. As you can imagine after I typed in the "first command" my Mac Mini server shut down and restarted but the loading bar won't get past half way when it tries to boot.

Is there any way to restore the launch daemons after unloading them all? Any and all help is appreciated.
The command sudo launchctl unload -w /System/Library/LaunchDaemons/ disables all launch daemons residing in /System/Library/LaunchDaemons/ by adding a key with the name of the launch daemon followed by true in the file /var/db/com.apple.xpc.launchd/disabled.plist. Even if the launch daemon had an entry set to false (like com.apple.emond in the examples below) in the file previously, it will be set to true. The disabled.plist overrides all settings in the individual plist files. The single launch daemon plist files in /System/Library/LaunchDaemons/ won't be altered.

Example before the above command was issued:

&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.AppleFileServer&lt;/key&gt;
    &lt;true/&gt;
    &lt;key&gt;com.apple.hdiejectd&lt;/key&gt;
    &lt;false/&gt;
    &lt;key&gt;com.apple.emond&lt;/key&gt;
    &lt;false/&gt;


Example after the above command was issued:

&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.AppleFileServer&lt;/key&gt;
    &lt;true/&gt;
    &lt;key&gt;com.apple.afpfs_checkafp&lt;/key&gt;
    &lt;true/&gt;
    &lt;key&gt;com.apple.AirPlayXPCHelper&lt;/key&gt;
    &lt;true/&gt;
    &lt;key&gt;com.apple.applessdstatistics&lt;/key&gt;
    &lt;true/&gt;
    &lt;key&gt;com.apple.auditd&lt;/key&gt;
    &lt;true/&gt;
    ...
    &lt;key&gt;com.apple.emond&lt;/key&gt;
    &lt;true/&gt;
    ...




So essentially you have to remove /var/db/com.apple.xpc.launchd/disabled.plist on your main volume or replace it by a backup copy:


Replacing the file by a backup copy is preferred because it may already have some non-default entries for some launch daemons set to true or false.
If you don't have a backup copy of the file boot to Recovery or Internet Recovery Mode
Open Terminal
mount your main volume if it's not already mounted
enter cd /Volumes/[Name_Of_Your_Main_Volume]/var/db/com.apple.xpc.launchd/ to change to your main volume
enter pwd to be sure about your working directory
remove disabled.plist with rm disabled.plist
To rebuild the (hopefully) standard disabled.plist write or copy and paste the following using nano or vi into a new document at the same place after executing touch disabled.plist:

&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.emond&lt;/key&gt;
    &lt;false/&gt;
    &lt;key&gt;org.postfix.master&lt;/key&gt;
    &lt;true/&gt;
    &lt;key&gt;com.apple.ftpd&lt;/key&gt;
    &lt;true/&gt;
    &lt;key&gt;com.apple.usbmuxd&lt;/key&gt;
    &lt;false/&gt;
    &lt;key&gt;com.apple.emlog&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.apache.httpd&lt;/key&gt;
    &lt;true/&gt;
&lt;/dict&gt;
&lt;/plist&gt;


You may do this later also, after rebooting to your main volume with:

sudo nano /var/db/com.apple.xpc.launchd/disabled.plist


After the reboot the file should have been rebuilt automatically (but almost empty) and you don't have to create it first.
Enter exit
Reboot to your main volume


This worked for me (explicitly not executing the command launchctl load -w /System/Library/LaunchDaemons/ as proposed by Graham). So your mileage may vary, because you executed the command earlier.