Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

ChadGippidy

macrumors newbie
Original poster
Dec 11, 2024
18
10
Hi everyone,

I'm new to MacOS and looking for reliable ways to remotely trigger sleep and wake on my Mac for tasks like running a Jellyfin server, file sharing, and Tailscale. I’d like to set this up for both local network (LAN) access and remote access over the internet.

So far, I’ve tried sending a Wake-on-LAN (WOL) packet from the same LAN, but I’ve noticed the Mac goes back to sleep after about 30 seconds. I’m thinking I might need to set up some triggers or actions using tools like Amphetamine to keep it awake when needed.

I know some people suggest never putting the Mac to sleep because its power consumption is minimal, but in my case, I have an HDD and SSD attached, and my Mac mini (M4) idles at around 13W—which does add up over time.

In the past people used to change the value of a parameter "darkwake" in the system files to alter sleep / wake behaviour in MacOS. The issue with that setting is that I coudln't find any documentation available and it now requires SIP disabled.

Does anyone have advice or recommendations on how to achieve this setup effectively?
 
I *think* just sleep your disks attached will give you single digit watts idling which is easier.

If you really want to go the hard way, you make a small bot that clicks the power button remotely which is surprisingly common in data-centers hosting Mac Minis where all Mac Minis need to be remotely power cycled.
 
Regular idle with sleeping disks is still around 13w. Nothing crazy, but I like optimizing.

I *think* just sleep your disks attached will give you single digit watts idling which is easier.

If you really want to go the hard way, you make a small bot that clicks the power button remotely which is surprisingly common in data-centers hosting Mac Minis where all Mac Minis need to be remotely power cycled.

I did not think of this. Woudlnt know where to start to be honest.

Right now I have attempted to send multiple WOL packets in a row to see if they reset the "awake" time. Nope, the machine still goes to sleep even as it receives WOL packets.

Since accessing shared folders actually keeps the mini awake I was thinking of creating a script that moves beetwen shared folders every 20 seconds or so and runs on something like Arduino / Raspberry Pi.
 
Why do you want to keep the Mac awake when it is not doing something? If the sleeping Mac wakes up when a client needs something from it, why is this not already the desired behavior?

OK if you want to control power buy a smart plug. These are connected by WiFi, Zigbee, or Thread and will control the power at the AC wall outlet. I have a couple of 3D printers and a machine tool that are driven by an older tower PC running Linux with Intel i5 that uses a lot more power than a Mac. I use the smart plug to completely shut the PC off to zero Watts when the computer is not needed. I also have webcams on that PC and some lighting and I control the lighting remotely using the same kind of smart plug. The plugs can be controlled with an iPhone, the Apple Home App or many third-party apps or from your own DIY automation.

Here is one example of "smart plug" https://www.amazon.com/Onvis-Matter-Thread-Outlet-Google/dp/B0CWTKW9BB/
 
As an Amazon Associate, MacRumors earns a commission from qualifying purchases made through links in this post.
Why do you want to keep the Mac awake when it is not doing something? If the sleeping Mac wakes up when a client needs something from it, why is this not already the desired behavior?
Other way around. I want the mac to sleep when I'm not using it, because it uses much less power that way.
But if you try to remotely wake it with Wake on Lan packets it stays awake only for 30seconds / 1 minute, even if there are background processes (Jellyfin, Tailscale, Amphetamine etc).

On the other hand, accessing shared drives keeps the mac awake while you are browsing the folders.

I am simply trying to find a way to properly trigger wake and sleep remotely.
 
I want the mac to sleep when I'm not using it
It does this already, hence the need for WOL packets. It used to be on Intel Macs there was thing called "power nap" that put the CPU into some very low power state. This feature was removed on M-series as they automatically scale power by switching off cores.

Just go to Setting -> Energy and make sure to put the disks to sleep when possible.

The M series has not "sleep" mode. Power use scales with activity. Today a maxed-out M4 Mini will burn 5W of power if it is not doing anything but the normal background tasks. (4W for the base model) If allowed to do this 24*7 for a full year and if power costs $0.20 per KHW then the cost of idling all year is about $9.00. So that is the maximum potential savings if you could find a way to make it sleep at zero-watts and it slept for an entire year.

But you might want to use the computer now and then and any sleep mode will be more than zero watts so the potential savings is well under $9 per year. With effort you might find so way to save $5 per year.

If you pay 40 cents/KHW then double those numbers.


As said, the Mac already does what you want, it reduces the power used when not in use to about 5W. OK you have added a power-hungry storage system. So click the option to power it down when possible. There is the problem that some external storage ignores the power-down command and continues to run. The only option is to replace it.

My external storage seems to follow Apple's example and has no "sleep" mode but rather consumes power based on usage so the power used falls to just a couple watts if no data is being moved.
 
It does this already, hence the need for WOL packets. It used to be on Intel Macs there was thing called "power nap" that put the CPU into some very low power state. This feature was removed on M-series as they automatically scale power by switching off cores.

Just go to Setting -> Energy and make sure to put the disks to sleep when possible.

The M series has not "sleep" mode. Power use scales with activity. Today a maxed-out M4 Mini will burn 5W of power if it is not doing anything but the normal background tasks. (4W for the base model) If allowed to do this 24*7 for a full year and if power costs $0.20 per KHW then the cost of idling all year is about $9.00. So that is the maximum potential savings if you could find a way to make it sleep at zero-watts and it slept for an entire year.

But you might want to use the computer now and then and any sleep mode will be more than zero watts so the potential savings is well under $9 per year. With effort you might find so way to save $5 per year.

If you pay 40 cents/KHW then double those numbers.


As said, the Mac already does what you want, it reduces the power used when not in use to about 5W. OK you have added a power-hungry storage system. So click the option to power it down when possible. There is the problem that some external storage ignores the power-down command and continues to run. The only option is to replace it.

My external storage seems to follow Apple's example and has no "sleep" mode but rather consumes power based on usage so the power used falls to just a couple watts if no data is being moved.

Sleep mode is still very much alive in macOS, even with the M series. I know this because I’ve been monitoring power consumption.

The base M4 Mac mini consumes around 2-3W while idle. In sleep mode, it drops to less than 1W.

However, the issue isn’t the power consumption of the M processor itself. With an HDD and SSD attached, idle power consumption increases to 13-15W (yes, even with the HDD in sleep mode). In sleep mode, this reduces to 4-5W.

Just because the M processors are highly efficient doesn’t mean sleep mode optimizations aren’t useful for all the peripherals attached. Or that M-series does not have "sleep" mode...
 
Last edited:
Alright, I've figured this out. It was pretty simple.

Connecting with ssh remotely will keep your mac awake. Once you're in set a caffeine command or keep the ssh connection active.

Interestingly if I start a caffeine process for like 120 seconds the mac stays up indefinitely.
So if that happens to you too and you want the mac to sleep simply run 'sudo pmset sleepnow' and then close the ssh connection.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.