I'm about to download a 1TB collection of files. It'll take about 7 days.

I want to make sure that my computer doesn't shut down or restart while the download is happening.


I found a simple solution that's been working for 6 days. Even when I intentionally try to restart my computer as a test, the computer stays on.

What I did is leave a Word Doc open with random text in it, but I didn't save it.

That shows me an error when my computer tries to restart, but it keeps the system on.

This is the error message I get

| improve this answer | |

There may be a piece of commercial software that can intercept a call to reboot/shutdown however I do not know what it is, if it exists. My suggestion, despite you editing out the issue in your OP, is to fix the issue and not look for a workaround!

That said, I give you a workaround that you certainly can test and it should prevent a software call to reboot/shutdown however if the reboot/shutdown is being caused by a hardware issue then this will not work.

You can rename the reboot and shutdown commands in: /sbin

Example in a Terminal:

sudo mv /sbin/reboot /sbin/reboot.ori
sudo mv /sbin/shutdown /sbin/shutdown.ori
  • Note: Once you renamed the reboot and shutdown commands the Apple menu's Reboot... and Shut Down... commands will not work.

If you need to reboot/shutdown, before renaming them back, you'll have to do it from a Terminal using: sudo /sbin/reboot.ori or sudo /sbin/shutdown.ori

The reason you need to do both, even though you say it rebooting not shutting down, is because without knowing the cause of your reboot issue the shutdown command can be use to reboot not just the reboot command, e.g. shutdown -r now will immediately reboot the system.

| improve this answer | |

Go to System Preferences —› Security and Privacy —› Advanced..., then uncheck Log out after X minutes of inactivity.

You may need to enter your admin password before you can access this button.

I had a similar question and this fixed it.

| improve this answer | |

I've been trying to accomplish this for quite some time now. I've tried various quick fixes and solutions over the years, none of which have been completely bulletproof, or simply not viable for other reasons.

The reason for all this

Is in 99% of the cases the the os wants to update itself, or system apps. And yes, this despite turning off all settings pertaining to automatic updates in the osx settings. Simply put; Apple wants YOU to always update your mac! IMHO, It's actually a serious issue that apple doesn't want to allow you to be truly in control of your own computers' behavior... But that's another question.

If the OS gets a shutdown/reboot command it will get intercepted, and a user prompt pops up. However sadly, after a while if no user input is given, the computer will still shutdown/reboot. To my knowledge there is no way to completely prevent a reboot of OSX for more than about three months. This is my own experience, anyway.

I am currently using the following solution, which ensures computer stays on for on average 30 days (without any user input, longer if periodically logged into and doing stuff), while still allowing the computer to run screensaver, log out the user, and going into power-saving mode. On demand, I can easily shutdown or reboot the computer using the standard GUI.

I created a bash-script that I saved on the desktop containing the following code:


while :
    echo "This BASH-Script prevents automatic reboot of this computer. Press [CTRL+C] or shutdown this terminal to disable and allow automatic reboot."
    sleep 30

I use automator to run this script with sudo, in an open terminal window on every startup/login.

I hope this answer helps anyone out there who wants their computer staying on!

| improve this answer | |
  • As already mentioned feedback to other answers should be added as comment there. Also, what is considered "best" may differ from person to person, that's why users here can up/downvote answers they like/don't fully approve. Please have a look at the FAQ to learn more about how this site works and how it differs from the typical discussion forum. – nohillside Jan 8 at 6:08
  • Having said that: Your method doesn't protect against somebody running sudo shutdown -r now "Forced reboot" or similar. But then, probably nothing does :) – nohillside Jan 8 at 6:09
  • @nohillside : Of course I realize that different people will have different experiences, which is why I wrote "the best solution* in my experience*". Regarding your second comment, I wouldn't really call that an automatic reboot. My method doesn't "protect" against ctrl+c -> apple -> power off, either. But that's not something I want to protect against, since that's a user input. I.e. a desired shutdown/reboot. The method protects against unexpected reboots due to updates or otherwise software-invoked. – Spcaeyob Jan 8 at 10:18

You must log in to answer this question.

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