I'm looking for an auto shutdown app that will forcefully shut down the computer at an appointed time.

The most important part of this is that the shutdown should not be cancelable (unless the process is extremely onerous).

  • What do you mean by "app"? Does it have to be a GUI program or is launchd (which I suggest below) acceptable? If you do what a GUI app, what do you want it to do? Prompt for the time that the computer should be shutdown, when run?
    – TJ Luoma
    Sep 20, 2011 at 18:05
  • Can you explain a bit more about the scenario? What model of Mac and OS? Why is shutdown important; how do you define an 'onerous' task? Are you OK with losing unsaved data, or do you want an attempt to save and quit all apps?
    – benwiggy
    Mar 27, 2022 at 15:02
  • @benwiggy It's just a matter of making sure I have a decent sleep schedule. Sometimes I'm "in the middle of something" or have to "watch an important youtube video". But those excuses are actually never good enough to delay the bedtime. However, if the autoshutdown is something that can be turned off I'm tempted to go and turn it off. I want to avoid that temptation. I'm fine with losing unsaved data.
    – Harry
    Mar 27, 2022 at 15:08
  • @benwiggy I'm currently using a 27inch 2019 intel imac. I think anything with a GUI would count as "not onerous".
    – Harry
    Mar 27, 2022 at 15:10
  • 1
    I also have sleeping issues, so I believe you need the good old alarm clock, far away from the computer. I have two key moments, one to take my medicine and another to study 5 minutes of Duolingo before midnight (or else I will lose my 750+ days streak). So after that, I watch a 30 minutes sitcom in bed on my phone with minimum brightness, and if I am still not sleepy enough a good stand-up comedy will do the trick because I can listen with my eyes closed. Mar 27, 2022 at 15:20

7 Answers 7


Ok, so further to my previous answer, I can walk you through getting cron (a built in UNIX schedule service) to run a scheduled shutdown command for you.

It will run as root and will be forced.

  • Open Terminal (/Applications/Utilities/Terminal)
  • Input sudo crontab -e

You'll need to enter your login password and then press enter.

You'll now be in a text editor (vim). Carefully input the following keystrokes.

  • Press i once (this will allow you to enter text)

Let's say you want the machine to shutdown at 2am every day, we'd now enter:

* 2 * * * /sbin/shutdown -h now

If you wanted the machine to shutdown at 2:30am every day, you'd enter:

30 2 * * * /sbin/shutdown -h now
  • When you've typed this in, press esc
  • Then press shift+z shift+z (that's uppercase "z" twice, to writes the changes and quit the editor)

You should now be dropped back to the command line where you started.

You're done!

  • Don't you need to put sudo there? I know that will probably cause it to hang up, but I'm pretty sure you have to be root to run shutdown.
    – daviesgeek
    Sep 17, 2011 at 15:13
  • 3
    @daveisgeek - You are totally right, but note that we startup crontab with sudo. This means that we are editing root's crontab and therefore any scheduled commands within will be executed as that user.
    – macaco
    Sep 17, 2011 at 15:59
  • 3
    shutdown is in /sbin which is probably not in the default $PATH of cron. To fix, do the sudo crontab -e thing again, type dd to delete the line (assuming the file looks like the one you linked above) and reenter the line as 30 22 * * * /sbin/shutdown -h now.
    – nohillside
    Sep 20, 2011 at 21:07
  • 1
    How to cancel this crontab?
    – Johnykutty
    Dec 20, 2014 at 11:18
  • 1
    yeah how do you reverse this if you don't want to do this anymore? Nov 4, 2015 at 3:42

It can be canceled though:

Halt at yymmddhhmm:

shutdown -h 1109211555

Halt in 4 minutes:

shutdown -h +4


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
<plist version="1.0">


If the plist was owned by a normal user, trying to load it would result in the error launchctl: Dubious ownership on file (skipping):

sudo chown root /Library/LaunchAgents/me.lri.forceshutdown.plist

The agent can be loaded by logging out and back in, or with:

sudo launchctl load /Library/LaunchAgents/me.lri.forceshutdown.plist

sudo crontab -e

`08 16 * * * /sbin/shutdown -h now`

This would perform a normal non-forced shut down:

osascript -e 'tell app "System Events" to shut down'
  • When adding the shutdown command to a launchd agent in /Library/LaunchAgents/, it didnt work and 'console' would log 'shutdown: NOT super-user'. Perhaps this would have worked in /System/Library/LaunchAgents (but you're not supposed to put stuff there :-)) I only needed a normal shutdown, so I went with the osascript, and put it in ~/Library/LaunchAgents/bla.shutdown.plist. Worked fine.
    – commonpike
    Jan 28, 2012 at 15:56
  • I had to use <code>osascript -e 'tell app "Finder" to shut down'</code> though
    – commonpike
    Jan 28, 2012 at 15:59
  • This is the only correct answer. (in my opinion) Sep 13, 2014 at 13:24

This can be scheduled in System Preferences > Energy Saver > Schedule. I'm not certain that this will initiate a forced shutdown, you'd have to try it out. But that's a built in option to automate scheduled power down/up.

  • You can also forcibly shutdown the system with a terminal command (requires root):

    shutdown -h now

    You could put that command into a launchd or cron scheduled task. Check out this article for far more info on those two services.

  • You may also want to check out an application like the aptly named iWannaSleep (not sure if this forces shutdown).

  • What...??? I'm looking for an app.
    – Harry
    Sep 17, 2011 at 13:22
  • 2
    You may want to appear less ungrateful, but if you reread my answer you'll see that I recommend an app and if you do a little independent research you'll see that there are actually a few more applications that have this ability!
    – macaco
    Sep 17, 2011 at 13:28
  • iWannaSleep is the first result that people recommend on google, and it doesn't do what I want. And you're recommending me learn some unix thing to shut down the computer?
    – Harry
    Sep 17, 2011 at 13:49
  • 3
    I recommend it because it is an effective way to achieve what you want using built in tools. If you are unable to find an application that suits your needs then you may need to look to something along the lines of my suggestion.
    – macaco
    Sep 17, 2011 at 14:00
  • 2
    Energy Saver » Schedule is not a good answer, because it will prompt the user 10 minutes before shutdown and offer to cancel the process.
    – TJ Luoma
    Sep 20, 2011 at 17:53

You can use shutdown directly to schedule a shutdown at any given time in the future:

shutdown -h time

where time specifies a future time in one of two formats: +number, or yymmddhhmm, where the year, month, and day may be defaulted to the current system values. The first form brings the system down in number minutes and the second at the absolute time specified.


Nicer Scheduled Shut Down

If you want to safely shut down your Mac at a scheduled time, consider Power Manager; it shuts down nicely without letting applications block the process:

  • All active users are given ample notification.
  • A large warning is shown shortly before shut down begins.
  • Running applications are asked nicely to quit.
  • Applications ignoring the nice request are more firmly quit.
  • Log out is left to complete, before the Mac is finally shut down.

It is very difficult for a rogue application or process to block these steps.

Why not shutdown

Using shutdown will force quit all processes on your Mac, including graphical applications. For many applications this is aggressive behaviour and does not provide the application with much opportunity to save state or data.

Schedule Assistant

Power Manager includes a Schedule Assistant task for shutting down to a schedule.

Power Manager - power off daily task

Disclosure: I work with the company who make Power Manager.

cd ~/Downloads/

curl --remote-name http://dl.dropbox.com/u/18414/ase/com.tjluoma.forceshutdown.plist

# see note below

sudo mv com.tjluoma.forceshutdown.plist /Library/LaunchAgents

sudo chown root:wheel /Library/LaunchAgents/com.tjluoma.forceshutdown.plist

sudo launchctl load /Library/LaunchAgents/com.tjluoma.forceshutdown.plist


As written, the plist will cause the computer to be shutdown at 11pm (local time) every day.

If you want to change the time, edit the script in any text editor. Change the Hour and Minute keys, excerpted here:


(note the use of 24-hour time)


I'd take a look at this tech note by Apple

  • you can use SendAppleEventToSystemProcess(kAEShutDown) then you can use the command killall -u username to kill all apps (since you don't want it cancelable) you might also want to check out the timer class: developer.apple.com/library/mac/#documentation/Cocoa/Reference/… Sep 17, 2011 at 14:28
  • 1
    Great article, but OP was balking about using cron or launchd, I doubt he's looking to code his own solution to this problem.
    – macaco
    Sep 17, 2011 at 14:35
  • 1
    Whilst this may theoretically answer the question, it would be preferable to include the essential parts of the answer here, and provide the link for reference.
    – daviesgeek
    Nov 16, 2011 at 18:35

You must log in to answer this question.

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