Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Prevent a Mac from sleeping from the command line UNIX
We've run a number of hints about preventing a Mac from sleeping, such as this and this.

I came across another really simple way to do this, using the pmset command. Just run this command in terminal:

pmset noidle

Terminal will display the following text:

Preventing idle sleep (^C to exit)...

To allow the Mac to go back to sleep, according to its current Energy Saver settings, just press Control-C.
    •    
  • Currently 3.14 / 5
  You rated: 5 / 5 (7 votes cast)
 
[9,373 views]  

Prevent a Mac from sleeping from the command line | 4 comments | Create New Account
Click here to return to the 'Prevent a Mac from sleeping from the command line ' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Prevent a Mac from sleeping from the command line
Authored by: matverna on Jun 24, '13 07:56:27AM

There is a FAR FAR simpler way to prevent a mac from sleeping. I've been using it for over a decade.

Set a hot corner to "Disable Screen Saver" from the System Preferences.
Then move your mouse to that corner when you need it to stay awake...

That's it - mac stays awake. No contraptions, no command line, no third-party software.



[ Reply to This | # ]
Prevent a Mac from sleeping from the command line
Authored by: kirkmc on Jun 25, '13 01:41:30AM

Sure, if you're in front of that Mac. But the command line is often useful for working on remote Macs.

---
Mac OS X Hints editor - Macworld senior contributor
http://www.mcelhearn.com



[ Reply to This | # ]
Prevent a Mac from sleeping from the command line
Authored by: Supp0rtLinux on Jun 24, '13 10:44:15AM

This doesn't JUST cause it not to sleep. It also disables ALL the power management. This can be fine for certain tasks like watching movies, etc but has the downside of draining batteries quickly. Apps that do this for free (like Caffeine) only affect the display power mgmt and even still allow brightness control but still allow fan spin up/down, CPU idle, etc. Great hint for a simple, built-in way to do it. But just be aware that this stops ALL power mgmt function until you hit CTRL-C and will drastically affect battery life on a portable so depending on the usage scenario you may want to keep a power brick around. Doing this will also cause your fans to go full speed which can be noisy.



[ Reply to This | # ]
Prevent a Mac from sleeping from the command line
Authored by: jaydisc on Jun 24, '13 04:51:53PM

This is perfect when doing a long, command-line task, like a large restore, copy or an rsync. Often in those situations, before using this, I'd come back to the machine, only to find it sleeping, with its network connectivity (and thus my transfer) disconnected.

ALTHOUGH… it looks like you can get more granular control with the built-in, command-line utility, caffeinate, like only preventing display sleep, AC power sleep, and also the ability to set timers.

man caffeinate

[ Reply to This | # ]