Is it possible to schedule a Mac to sleep just one time? I know I can set a schedule for it, but I want to have control over it.

So occasionally I'll go to bed but leave a file transferring, and I want the Mac to sleep about an hour from now. So how would I go about doing that, without setting a long-term schedule?

  • 2
    If you are downloading within the Terminal you could combine both commands similar to: sudo sh -c 'wget http://download.com/file.zip; pmset sleepnow' The sleep command will then only be executed when wget exits.
    – Overbryd
    Commented Jan 18, 2016 at 22:02

5 Answers 5


The pmset terminal command should do what you want. The following will put the computer to sleep at 23:45:00 on December 2, 2014. The command must be run from an administrator account though:

sudo pmset schedule sleep "12/02/14 23:45:00"

The MM/DD/YY date format cannot be changed; so, if you are used to a different format, use caution.

If you do this on a regular basis, you can write a function and save it to your ~/.profile:

# Schedule sleep in X minutes, use like: sleep-in 60
function sleep-in() {
  local minutes=$1
  local datetime=`date -v+${minutes}M +"%m/%d/%y %H:%M:%S"`
  sudo pmset schedule sleep "$datetime"
  • 2
    I was getting an error when calling the function sleep-in:local:2: not an identifier: 23:35:31. It turns out (at least on my install (zsh)) that you need to wrap that date backtick expression in double quotes. So do: local datetime="`date -v+${minutes}M +"%m/%d/%y %H:%M:%S"`"
    – Matt Dodge
    Commented Aug 2, 2016 at 14:07
  • Companion function for cancelling sleeps (replace "\n" with actual new lines): function sleep-cancel-all() {\n NUM_OF_SLEEPS=$(pmset -g sched | wc -l)\n if [[ $NUM_OF_SLEEPS -gt 0 ]]; then\n # The first line of output is a header, ignore it.\n NUM_OF_SLEEPS=$(expr $NUM_OF_SLEEPS - 1)\n seq $NUM_OF_SLEEPS | xargs -Iz sudo pmset schedule cancel 0\n fi\n }\n
    – KFunk
    Commented Jun 25, 2017 at 20:18

By default there is no way of doing that with the options you have in the system preferences.

enter image description here

But, you could do it from command line with a simple command:

sleep 10; osascript -e 'tell application "System Events" to sleep'
  • sleep 10 pause the execution of the following command for 10 seconds. If you want minutes or hours you must change 10 with number of seconds you want.
  • osascript -e 'tell application "System Events" to sleep' put the computer to sleep.
  • 1
    With GNU coreutils, sleep accepts arguments like 10s, 5m, 3h for seconds, minutes and hours respectively.
    – A T
    Commented Mar 20, 2019 at 23:41

Try man shutdown; it has an -s option for sleep-mode

shutdown -s <time>

where <time> can be:

  • now
  • +m e.g. +180 for 3 hours from now
  • yymmddhhmm e.g. 2112250000 for the moment it becomes Christmas (this year)

For power control of your Mac from your iPhone on a local network, I have used Off Remote which can also schedule within the next 24 hours a system action (Shutdown, Lock, Restart, Log off, Sleep) and is only $3 in the iOS store but requires installation of an additional helper app on your Mac to receive the instructions from the iPhone app.

Another answer here suggested using Power Manager software which costs $50, but I would suggest the $36 Keyboard Maestro software which is a bit less intuitive than Power Manager but has greater flexibility beyond power management. In searching for the ability to schedule my Mac to sleep, I remembered that I have this utility and was able to quickly drag and drop the macro components in KM to create a script that paused for a set period of time and then put my Mac to sleep:

keyboard maestro script to put Mac to sleep after 2 hours

…there is also an action within Keyboard Maestro to also schedule macros (to put Mac to sleep, shutdown, restart, etc.) to be triggered at designated times:

keyboard maestro trigger for macro based upon time and day(s) of week

Keyboard Maestro is cheaper and much more robust for developing macros that can enhance the use of your Mac, but there is a bit more of a learning curve than the Power Manager application.


All the above answers work, but if you want to do this regularly, I recommend the Power Manager software, which allows you to set custom sleep times, both for one time and recurring events very easily (far more easily than using Terminal commands, in my opinion). The software is relatively expensive ($50), but there is a free 30 day trial with all features. You can also control Power Manager from your iPhone, which is nice if you are away from your computer but want to set it to sleep or shut down.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .