Mac wakes up from sleep every two hours on Mac OS X Yosemite

Solution 1:

Since com.apple.mDNSResponder.plist got replaced by com.apple.discoveryd.plist after Yosemite Beta, there is another solution for your Problem.

All you have to do is to run following command in your terminal:

sudo /usr/libexec/PlistBuddy -c "Add :ProgramArguments: string --no-multicast" \ 
         /System/Library/LaunchDaemons/com.apple.discoveryd.plist    

And reboot your system and it should be gone.

Like also described here: http://ispire.me/fix-yosemite-rtc-alarm-wakeup-issue/

You just have to know that services relying on multicast might not work properly anymore after this change.

Solution 2:

The problem seems to have fixed itself after updating to Yosemite 10.10.2, released on January 28, 2015. The notes don't mention anything regarding sleep or wake but it seems to have fixed it regardless.

Solution 3:

Try this. It should work on 10.10.4 or later. Enter the following in Terminal and then restart your Mac:

sudo defaults write /System/Library/LaunchDaemons/com.apple.mDNSResponder.plist ProgramArguments -array-add -DisableSleepProxyClient

Solution 4:

There is another solution approach using the tool SleepWatcher by Bernhard Baehr. To install SleepWatcher, use:

brew install sleepwatcher

com.apple.discoveryd is just getting unloaded before sleep and loaded again after wake (see post by tseug in "Wake reason: RTC (Alarm) - how to deactivate?"). Edit the following config files as path suggested in comments and give some of the files execution permission:

# author: tseug (see link above)
# /Library/LaunchDaemons/de.bernhard-baehr.sleepwatcher.plist

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
        <key>Label</key>
        <string>de.bernhard-baehr.sleepwatcher</string>
        <key>ProgramArguments</key>
        <array>
                <string>/usr/local/sbin/sleepwatcher</string>
                <string>-V</string>
                <string>-s /etc/rc.sleep</string>
                <string>-w /etc/rc.wakeup</string>
        </array>
        <key>RunAtLoad</key>
        <true/>
        <key>KeepAlive</key>
        <true/>
</dict>
</plist>


# /etc/rc.sleep
# chmod +x /etc/rc.sleep

#!/bin/sh
# Unload discoveryd to disable maintenance wakeup every two hours
launchctl unload /System/Library/LaunchDaemons/com.apple.discoveryd.plist


# /etc/rc.wakeup
# chmod +x /etc/rc.wakeup

#!/bin/sh
# Load discoveryd to enable network
launchctl load /System/Library/LaunchDaemons/com.apple.discoveryd.plist