How to wake Mac for Automation

Is there a way to wake the Mac at specific time to run automation. I’ve used an app like Power Manager before but it isn’t the best. Is there a way to accmplish this without a 3-rd party app?

1 Like

Check out pmset. There is a good overview here.

2 Likes

Thank you, I set it up!

I setup these wakeorpoweron MTWRSU schedules but I don’t see wakeorpoweron on the schedule command. Any idea why?

schedule

1 Like

I don’t have access to a Mac right now (I’m mid-house move). But give this a try and see if it yields anything useful.

sudo pmset repeat wake MTWRF 8:00:00
pmset -g sched

This isn’t really working. The Mac screen doesn’t wake up.

Install and trigger Amphetamine programmatically as user to be done with Caffeinate?

See one of the answers In this old Stack Exchange thread for the premise.

Amphetamine supports AppleScript, and you can call AppleScript at the command line with osascript. That’s what I would explore to see if I could force wake the display along with the device.

Did you try and resolve this subsequent issue yourself in any way?

I’ve tried the wake action in Keyboard Maestro and I’ve tried the Power Manager which I know works but costs an annual subscription.

Yes, you can schedule your Mac to wake up at a specific time without relying on third-party apps. Apple’s built-in “Energy Saver” settings allow you to do this. Here’s how:

  1. Go to System Preferences: Click on the Apple logo in the top-left corner of your screen and select “System Preferences.”
  2. Energy Saver: In System Preferences, click on “Energy Saver.”
  3. Schedule: In the Energy Saver window, click the “Schedule” button in the bottom-right corner.
  4. Set Wake and Sleep Times: Check the box next to “Start up or wake” and then configure the time you want your Mac to wake up. You can set it to wake daily, on specific days, or just once.
  5. Save: Click “OK” or “Save” to apply the schedule.

Your Mac will now wake up at the specified time. This is a convenient way to run automation or other tasks without the need for third-party apps.

While it is absolutely a valid way to power on your Mac, do take note that pmset, as suggested above, provides a superset of this and allows for more flexible control with regards to automation.

What is the syntax for creating a link box like the one above? It would be very useful to know.

There is no syntax. It is just posting a raw URL. If the forum can retrieve the details to display a card view, it will. I assume it is basing it on the availability of Open graph data.

Going back to the original thread, did Amphetamine in combination with pmset do everything you then needed, or did you come across any further issues? You noted other things you previously tried, but no update on the offered solution.

No, I’ve tried pmset and Power Manager but the Mac still doesn’t stay awake long enough to run any automations.

It’s the weirdest thing, the Mac wakes up right at 8am and a few seconds later the screen turns off a few seconds later. and Bunch doesn’t run.

You said earlier you know that using Power Manager works, so presumably something has changed since then.

I would still recommend try using Amphetamine (free) and pmset (default in OS) as an equivalent combo seems to have worked for others in the past (see links above), and it seems to be something you have not tried.

You should also check you don’t have something immediately sending your Mac’s screen back to sleep. If you do, it may be nothing may work, or that results are variable.

I’ve reset Amphetamine and will try again.

Same result. Without user interaction, the screen turned on for a few seconds and then went back to sleep. Also, none of the automations launched automatically; they needed user input. I can only assume that’s because the screen was off, and I know that no modern automation applications can wake a Mac yet. I don’t know how to solve this issue. I need help from the Automators.

Like I said above. That sounds like you have something overriding the normal behaviour. The wake ups are working, but it seems like something else is forcing it back to sleep.

Maybe try an SMC reset. See if that changes the behaviour.

I thought you can’t reset the SMC, because the M1/2 Mac doesn’t have a System
Management Controller. You can’t manually reset the NVRAM / PRAM because
the Mac does this automatically, if needed, during every startup. At least that’s what I read. If this is incorrect, can you give me the key combination for an SMC reset?

https://discussions.apple.com/thread/252114787

Apple Silicon Macs do a reset on startup. You hadn’t shared what type of Mac you had, so I was making a suggestion based purely on the behaviour - SMC resets (on Intel) have commonly resolved power issues, which could have been a reason for the Mac entering sleep so quickly after a wake instruction.

You have to accept we are working a little blind here in trying to help your resolve this.

Based on what you have shared, and as I noted above, it sounds like something is triggering the sleep again - counter to the usual issue of Macs waking shortly after bing put to sleep.

My earlier suggestion was to investigate this avenue, so in your position I would have also been trying this without any external hardware other than a PSU connected, looking at what is set up in any scheduled or triggered automation utilities (including at the command line), reviewing system console logs to see if there is a message logged about an event that sent th Mac back to sleep, etc.

If you haven’t tried any of that, I thibk it would be a next reasonable step to do so.

  1. My Mac is an M2 Max Mac Studio.
  2. I only have one wake up time setup.

CleanShot 2024-01-03 at 09.29.28

  1. My Bunch automation did launch.
  2. The monitor still went back to sleep a few seconds after the wake up at 07:59:00.
  3. Could the issue be with the monitor itself?