Fix yosemite rtc alarm wakeup issue

This post is also available in: German

Fix yosemite rtc alarm wakeup issue

Fix yosemite rtc alarm wakeup issue

Fix yosemite rtc alarm wakeup issue


After installing new Apple Mac OS X 10.10 Yosemite i ran into an issue were my Macbook Pro wokeup every few hours with lid closed which was very irritating me. After every periodical wakeup my Macbook Pro showing me messages like “Wake reason: RTC (Alarm)” in my syslog. In this snippet i tell you howto Fix yosemite rtc alarm wakeup issue.

First of all, we backup the original file to be safe if something going wrong or for the case we wanna revert the changes later. Open your terminal app and copy following:

To check what causes the wake up of your Mac you can use following handy command in your terminal:

syslog |grep -i "Wake reason"

So if the wakeup reason is something like “Wake reason: RTC (Alarm)” it might be the bonjour multicast feature which prevents your Mac to stay chill in sleep mode.

Backup:

sudo [ -f ~/Downloads/com.apple.discoveryd.plist ] && echo "File already there. Not overwriting it" || cp -a /System/Library/LaunchDaemons/com.apple.discoveryd.plist ~/Downloads/

To disable and prevent the wake reason, we need to edit the plist file with your prefered editor like:

sudo vi /System/Library/LaunchDaemons/com.apple.discoveryd.plist

Next move down to the key “ProgramArguments” and append this string to it:

<string>--no-multicast</string>

so it finally looks like this:

       <key>ProgramArguments</key>
        <array>
                <string>/usr/libexec/discoveryd</string>
                <string>--udsocket</string>
                <string>standard</string>
                <string>--loglevel</string>
                <string>Basic</string>
                <string>--logclass</string>
                <string>Everything</string>
                <string>--logto</string>
                <string>asl</string>
                <string>--no-multicast</string>
        </array>

Be sure to have no typos or misleading characters e.g. inserted into plist file or your Mac won’t boot anymore. So better make a backup of that file before changing it.

To make sure that the plist changes are correct you can check the file syntax by entering following command:

plutil /System/Library/LaunchDaemons/com.apple.discoveryd.plist

If everything looks fine. Reboot your system, so it loads the new plist file. Now you have to re-enable Wifi and connect to your Accesspoint. After that change you will realize that the Wifi signal icon won’t show its signal strenght anymore but Wifi is still connected and seem to work fine. So a waking up Mac was a bader option for me than this wakeup fix.
One more note: Printer and NAS/NFS/Samba/AFP Shares e.g. will still reachable by it’s IP/Hostname.
So you can add it again by its IP adress/netpath without auto discovery service.

If something still went wrong or to Restore the changes to original ones you have to enter this command which copies the backup file back to its origin location which we saved by Backup task before:

sudo cp -a ~/Downloads/com.apple.discoveryd.plist /System/Library/LaunchDaemons/

Update:
I found another way to automate this task by using the MacOS internal command PlistBuddy.

So all you have to do now is executing following command in your terminal app:

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

and reboot the system or run following:

sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.discoveryd.plist
sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.discoveryd.plist

To revert the last change if something went wrong enter this command:

sudo /usr/libexec/PlistBuddy -c Revert /System/Library/LaunchDaemons/com.apple.discoveryd.plist

12/22/2014: Update — Testers wanted!
Please try my new suggestion to solve this issue and report!

I was playing around with the same issue one more time and disabled the date/time automatic sync and timezone detection on my Macbook.
Date & Time > Disable/Uncheck: Set date and time automatically
Time Zone > Disable/Uncheck: Set time zone automatically using current location

And guess what?
My Macbook did not woke up yet. Finally looks like it having the same effect than disabling Multicast but without all the flaws that came with the previous workaround.

So finally it should look like this:
fix-yosemite-rtc-alarm-wakeup-issue-date-time

and this (select your suitable Timezone if field is empty!):
fix-yosemite-rtc-alarm-wakeup-issue-timezone

Leave me a comment which solution works for you please!

Extra Bonus: I have encountered one more switch in new discoveryd.
Wondering: Why computer name changing constantly?

Here is the fix: https://ispire.me/computer-name-changing-constantly-yosemite/

Thats all folks!

Jules

Jules is the owner and author of ISPIRE.ME. He's a Linux System Engineer, Tech fanatic and an Open Source fan.

You may also like...

61 Responses

  1. Ron says:

    This worked fine. The only problem is my AirPort Express would no longer work.

    So, back to square one…

    • Jules says:

      True. All services that relying on multicast advertising might not work anymore.

      • Derrik M says:

        This change help my computer sleep but I also had to revert the changes since unfortunately a few really nice features rely on multicast including AirPlay, Wireless sync for iPhones/iPads and AppleTV to computer communications. If you don’t care about these then you are ok but would not consider this a true fix.

  2. Joerg Schmidt says:

    Thank you for the solution. Hope it works.
    By the way: How can i backup the file as you mentioned in your text?

    Greetings from Germany.
    Joerg

  3. Frank says:

    After applying the command, my Mac sleeps well…
    But it can’t find my WLAN printer anymore. 🙁

    I tried to revert the command using this line:
    PlistBuddy -c Revert /System/Library/LaunchDaemons/com.apple.discoveryd.plist

    Terminal says: “Command not found”
    So, how can I restore the original file?

    • Jules says:

      Hi Frank,

      It’s because the auto discovery service is dependent on multicast which we disabled by that task.
      But: Printer and also NAS/NFS/Samba/AFP Shares should still reachable by it’s IP. So you can add it again by its IP adress/Path.

      I also updated the correct commands in my Blog post.

  4. Cube says:

    Thanks so much for posting! This bug made it into the released version (does Apple do ANY QA at all I sometimes wonder?) and it’s a temporary fix at least.

    Can you tell us, how in the heck did you make the connection from a RTC wakeup alarm to the multicast setting?

  5. Raffaele says:

    That’s worked fine with me, thanks! Only my wi-fi is not working anymore. I deleted the service in Network prefpane and activated again, but still, wi-fi is not working and stays on “searching…” with no timeout 🙁

    • Jules says:

      Hi Raffaele,

      bad to hear that this doesn’t work for you. What is your setup? Is it a real Mac/Macbook?
      On my Macbook Pro 2008 it just worked fine and had just this Wifi display strength symptom i wrote.

  6. Anon4125 says:

    Don’t do this, for now. --no-multicast disables Bonjour services and currently breaks Wi-Fi in two ways: prevents auto-reconnection to remembered networks and it also breaks the status icon. (SystemUIServer and friends would need to be fixed.)

    • Jules says:

      I don’t have this behavior, exept the UI icon/Wifi signal strenght not getting displayed correctly.
      Since it’s just an UI displaying and not an connection/reconnection issue on my Macbook it doesn’t really interfere me.

  7. Jon says:

    Thanks! That helped me fix my hostname changing randomly after upgrading to 10.10

  8. Kevin says:

    Disabling multicast will likely cause many more problems for users. Apple really needs to patch this.

  9. Ron Miller says:

    If this is a bug in OS X Yosemite, why isn’t it universally present?

    My new iMac Retina wakes from sleep exactly every 60 minutes.

    My Mac Mini that was upgraded to Yosemite will sleep for days without waking.

    If this is a bug, why doesn’t it happen to all Macs running Yosemite?

  10. Soeren says:

    It is not a good solution.

    Timemachine won’t work anymore (to a TimeMachine Server), also share desktop does not work automatically if you select a server in Finder.

  11. Dan says:

    Amazingly, the first bug fix Yosemite release (10.10.1) does not address this. I had submitted a bug report, which got some traction (“Engineering requests that you …”). In the chain I gave them a link to this page and verified the fix, and recently they closed the bug as duplicate which seemed to indicate to me that it was fixed. Nope!

    One gotcha, the plist did change from 10.10 to 10.10.1, but when I updated my fix was still preserved. I’m not sure what happened there as I backed it out first, or thought I did. Anyhow I pulled a clean copy of the plist file from another computer I updated to 10.10.1 and used it, but the computer still woke up after a few hours.

    This is truly frustrating.

    • Jules says:

      Seems like your .plist file got cached with obsolete content.

      To purge the cache of the file try running:

      sudo defaults read /System/Library/LaunchDaemons/com.apple.discoveryd.plist

      And reboot your system or restart the service.

      • Dan says:

        Thanks Jules,
        Hmm, I tried that and it just spit out most of the file without the XML tags, and didn’t change the file at all. Reading the man page it looks like that command will just read it. There’s also a write command but that’s if I have plist to write or a key/value pair. Thoughts?

        • Jules says:

          Strange. i tought it will wipe the caching also. Maybe with sudo in front?

          Can you try following command which will load an unload the .plist file:

          sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.discoveryd.plist 
          sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.discoveryd.plist
          
          • Dan says:

            OK tried that, it still contains my last change (–no-multicast) which I put back after the 10.01 update. That is it doesn’t seem to change anything.

  12. Louis Le says:

    Hello Jules,
    Thanks for posting this, I got mine Yosemite Mackintosh to sleep overnight without rebooting with the AC power connected. Yes, I have to turn on the wifi, reconnect the SSID manually, but it works fine. Yes, I have to add the Wireless printer by using the IP address and it works perfectly.
    It’s a trade off, but I think it’s fine this way. At night after working on my laptop, I just want to close the lid, let it sleeps and in the morning, wake up and everything is there. Turn on the wifi and select the connection.
    I did the unload the recoveryd.plist before, the computer still rebooted after 2 hours with the AC power connected. So it didn’t really work with the original recoveryd.plist.

    Cheers,

    Louis

  13. emoxam says:

    After applying patch smb\cifs mounting stops working.

  14. Ethan says:

    I ran the commands and am happy that my Mac Pro running 10.10.1 sleeps without waking. However as others have noted I can no longer add a printer connected via USB to my Airport Extreme base station, let alone configure the base station via Airport Utility. Bonjour woes?
    I do however have wifi signal strength visible in the Menu bar…
    Any suggestions would be greatly appreciated.
    ~ Ethan

  15. LucianZhu says:

    Thank you Jules,
    that’s worked fine , fixed wakeup issue,
    but I found that \the UI icon/Wifi signal strenght not getting displayed\ issue was indeed exist.
    However,Wifi could not connect hotspot automatic ,
    I have to choose my own hotspot manual everytime ,
    and how to resolve this problem?
    Your reply will be highly appreciated.

  16. emoxam says:

    I don’t have any checkboxes in a ‘timezone’ tab. Also i can’t do not select anything. Other words – i must select something below

    • Jules says:

      No checkboxes in timezone?

      If you can select timezone manually, then automaticly is unchecked. Just select a suitable timezone you are in.

      • Louis Le says:

        It’s been working since “–no multicast”, no problems –
        1. Has to connect to wifi manually after waking up.
        2. Change printer to manual IP to connect automatically.
        3. Never had date-time-location problem.
        4. Yosemite 10.10.

      • emoxam says:

        ok, i’ve selecred manually
        kernel[0] : Wake reason: GLAN XHC EHC1

        • Jules says:

          Okay, you have a totally different Wake Reason that comes from your LAN Device then, that has nothing to do with the Wake Reason RTC Alarm i’m writing about here.

          Is this a Mac u are on?

          In your case you could do following: Go to your Energy saver options and disable wake for network!

          • emoxam says:

            pardon, that was waking from a keyboard pressing. So thats the log from an all day

            Dec 23 17:27:32 QWERTY1 kernel[0] : Wake reason: GLAN XHC EHC1
            Dec 23 23:56:05 QWERTY1 kernel[0] : Wake reason: RTC (Alarm)
            Dec 23 23:57:03 QWERTY1 kernel[0] : Wake reason: RTC (Alarm)
            Dec 24 03:33:59 QWERTY1 kernel[0] : Wake reason: RTC (Alarm)
            Dec 24 05:22:56 QWERTY1 kernel[0] : Wake reason: RTC (Alarm)
            Dec 24 07:11:53 QWERTY1 kernel[0] : Wake reason: RTC (Alarm)
            Dec 24 09:00:50 QWERTY1 kernel[0] : Wake reason: RTC (Alarm)
            Dec 24 10:49:47 QWERTY1 kernel[0] : Wake reason: RTC (Alarm)
            Dec 24 12:38:44 QWERTY1 kernel[0] : Wake reason: RTC (Alarm)
            Dec 24 14:27:41 QWERTY1 kernel[0] : Wake reason: RTC (Alarm)
            Dec 24 16:16:38 QWERTY1 kernel[0] : Wake reason: RTC (Alarm)
            Dec 24 17:22:41 QWERTY1 kernel[0] : Wake reason: PWRB (User)

  17. Filip says:

    Not working for me, it’s waking every 2 hours as previous.

  18. Mookie says:

    Found this solution after searching awhile. I have a one month old MacBook air that was losing more charge than it should while in sleep. I tried the time settings you posted and let my MBA sleep overnight. This morning I was at 97% and the terminal log no longer shows RTC (Alarm) every 2 hours or so. I’ll keep you posted going forward.

  19. REMY says:

    the last tip (uncheck time/date) didn’t work for me : still those annoying RTC alarm every 2 hours…
    would have been really cool if it worked.

    I called Apple Care 2 months ago, we ran lots of tests, and they told me the engineers are checking this out.

    to be followed…

    • Jules says:

      Hi Remy,

      okay thats very weird. It just works perfect on my Macbook Pro 2008 Late with 10.10.2

      Have you unchecked automatic timezone also?

      • REMY says:

        sure, it doesn’t work on my computer (imac, mid-2011), even with the two options unchecked.
        There must be another trigger somewhere, another setting … when correctly set with time/date, the imac won’t wake, but for now, nothing has changed.
        cheers

  20. REMY says:

    Hi again,

    The 2 checkboxes have been unchecked, and that XXXX RTC alarm is still comin’ back 🙁

    maybe the computer needs to be restarted ?

  21. Dulle says:

    Hi,

    unchecking date/time did the trick for me. No more waking ups.

    Ludo

  22. Dan says:

    Remy,
    It doesn’t work for me either. There’s more going on, and my amazement that Apple still hasn’t fixed this continues.

  23. Frans says:

    Unchecking date/time did NOT do the trick for me. After unchecking and rebooting, my MacBook, Late 2008 still wakes up (on a TimeMachine based network with an Apple TV connected). Wake on network access is also unchecked.

  24. REMY says:

    I also tried to uncheck time/date on my macbook air, and it keeps on waking every 2 hours when plugged with AC. (not when on battery).

  25. Bith says:

    Disabling automatic time setting does not worked for me. (auto timezone wasn’t an option)

  26. Marc says:

    Hi,

    the second solution (Date & Time) works very well for me.

    Thanks!
    Marc

  27. ae says:

    Restting the SMC might also help fixing the RTC wake problem according to: http://www.macissues.com/2014/04/16/determine-the-reason-why-your-mac-wakes-up/

    Am giving it a try and see what happens.

  28. ae says:

    Resetting the SMC doesn’t work in my case. Also disabling NTP doesn’t change, my MBA still wakes every few hours. Any ideas?

  29. REMY says:

    UPDATE 10.10.2 : no more RTC wake up !
    Better late than never 🙂

    thanx to everyone that tried to help,
    till next time

  30. Frans says:

    Ditto for me, at least for the first 24h after installing the 10.10.2 update my computer has not been waking up spontaneously!

  31. Dan says:

    Yes fixed my several macs that had the problem. It’s clear now what the deal was, the fix didn’t make it in time for the 10.10.1 update, so got bundled into the 10.10.2. Unfortunate for those of us dealing with the issue, it is true that Apple software quality is at an all time low, but at least this did get fixed.

  32. KW says:

    Wow, all I had to do was disable the time auto-sync and time zone detection, and it stopped the wake-ups that were occurring every couple hours. Thanks, you’ve solved what Apple couldn’t fix in 10.10.2!

  33. Chez says:

    Finally, this recent update fixed this! Been ongoing since October, waking me up during the night. Absolutely ridiculous, I can’t believe they didn’t do anything about it sooner.

  34. Jakob says:

    This worked for me on Yosemite.
    However, after the upgrade to pre-release El Capitan, I have the problem again.
    I can’t proceed according to this tutorial since there seems to be _no_ discoveryd (no /System/Library/LaunchDaemons/com.apple.discoveryd.plist) on El Capitan.
    Does anyone have an idea?

  35. Fabien says:

    Hello,
    Like Jakob, RTC wakeup come back every two hours with El Capitan.
    Wait for an Update.
    Thank you.

  36. Steffi says:

    Learning a ton from these neat arstilec.

Leave a Reply

Your email address will not be published. Required fields are marked *

Human Verification: In order to verify that you are a human and not a spam bot, please enter the answer into the following box below based on the instructions contained in the graphic.