60

When I try to download large apps from the App Store whether on battery or AC power the displays turns off after time set and downloading also stops.

The Energy Saver preferences are set to defaults.

What should I do to continue download even when display is off?

I am using OS X 10.9.4

13 Answers 13

97

If you don't want to install any software or change settings, you can use the Terminal utility caffeinate. Open Terminal (located in /Applications/Utilities/), type in caffeinate, and press return ↩︎.

If you want to set a timeout so it will go to sleep after some amount of time, use this:

caffeinate -t 3600

That will make it stay awake for an hour. (3600 is the number of seconds you want it to stay awake.)

To stop or cancel the caffeinate command, press ^ ControlC.

5
  • 2
    Best answer so far, so handy for terminal lovers! Gonna try it now. Commented Dec 23, 2016 at 8:53
  • 6
    You could also caffeinate program [arguments] to make Mac awake as long as the program is running, which is handy for testing scripts over night: caffeinate python script.py. Love it!
    – taper
    Commented Dec 29, 2017 at 16:09
  • 1
    It needs to have the -s flag to prevent downloads from stoping. Commented Jun 25, 2018 at 1:44
  • It kind of amazes me that a company that prides itself for making products that "Just works(tm)" requires us to resort to something like this.
    – Jack Leow
    Commented Sep 24, 2021 at 20:22
  • I don't think of it as "resorting" to something like this. Using caffeinate follows the "just works" principle. I would not want my computer to remain unlocked if I am in a public space unless I explicitly told it to do so because I know I'm not going anywhere. It'd be too easy for someone to start some download and forget that the mac is not going to go to sleep if "don't go to sleep during downloads" was on all the time by default.
    – Speeddymon
    Commented Jul 5, 2023 at 16:43
10

You could set hot corners. Push the cursor to that corner & it won't nod off.

That would save you having to change the regular policy, for the times you do want it to sleep after being idle.

enter image description here

7
  • 1
    This would either disable the screensaver or put the display to sleep, it's not going to prevent the laptop from going to sleep right?
    – Prabhu
    Commented May 13, 2016 at 4:01
  • I haven't actually used it in years - my last 2 machines have never slept, in 8 years - but it used to be that if the screen didn't sleep, neither did the computer. Easy enough to test...
    – Tetsujin
    Commented May 13, 2016 at 19:17
  • The panels have changed and this is no longer accurate. Use "Energy saver" panel.
    – BondedDust
    Commented Feb 21, 2018 at 19:12
  • @BondedDust - you could either fully edit the new info into this answer, subject to approval, or add a new answer. I'm still on El Cap, where it's still true.
    – Tetsujin
    Commented Feb 21, 2018 at 19:27
  • Color me puzzled. I'm on El Cap too, but I don't get that graphic.
    – BondedDust
    Commented Feb 21, 2018 at 19:29
8

you can use caffeinate -w <the Process ID of the download> for this.

  • caffeinate command makes your computer unable to fall asleep (although your display may),

  • the -w option makes it wait for a process to finish and before then your computer cannot fall sleep, which is exactly what you wanted to do.

to do so you can first find the Process ID(PID) for your download with Activity Monitor, then open up Terminal(bash) and type in for example caffeinate -w 4708, replace the number with the PID you found.

  • be careful with a low PID number as it may be a system process, in which case your computer may run on until the battery dies.

  • also if you plan on using this command often on certain processes, you may want to use caffeinate -w $(pidof <name of process>) instead, this will find the ID of the process you name each time (as PID is assigned by the system and will change each time you run it)

the advantage this has over

  • changing system preferences: it doesn't require you to change the preference back once you're finished

  • caffeinate -t <number of seconds>: your download may not finish in a certain amount of time, in that case the goal is not achieved; or it may finish really quickly, in that case you would be wasting energy.

6

You could try Caffeine from the Mac App Store:

Caffeine is a tiny program that puts an icon in the right side of your menu bar. Click it to prevent your Mac from automatically going to sleep, dimming the screen or starting screen savers. Click it again to go back. Right-click (or -click) the icon to show the menu.

5

In you Energy Saver options, just change "Computer sleep" option. For exemple you could put "Computer sleep" option to "Never" While on Power Adapter.

Default option put your Mac to sleep after 15 minutes while on Power Adapter.

1
  • I did this, it worked great.
    – Flare Cat
    Commented Jan 10, 2016 at 18:12
4

I suggest Amphetamine, downloadable from the app store or here. Using the app, you can set up custom periods for your computer to sleep.

1
3
  1. Check Prevent computer from sleeping when the display is off in the Energy Saver setting under System Preferences.
  2. Leave it or press shift+control+Power to turn off the Display.
2

As I don't want to install any software nor want to use the Terminal for such a trivial task (nor have found any setting allowing me to never have my Mac sleeping), I use this:

https://www.youtube.com/watch?v=G1IbRujko-A

Apparently, opening a Youtube video and keeping the focus on its tab prevents Chrome from sleeping (as you fake watching a video) until the video ends.

You can then put the brightness to 0 and leave the computer without anxiety: the download will still be ongoing.

5
  • would this work for any kind of video player, even offline ? Also, youtube these days prompts for "Still watching" prompt, so it could go to sleep.
    – anki
    Commented Nov 24, 2019 at 23:55
  • I tried on the free version of Elmedia Video Player, and it works. I didn't try on Quicktime Player, and for now, I did not have the "Still watching" prompt.
    – Gregordy
    Commented Nov 25, 2019 at 2:01
  • 1
    Oh that happens when YouTube is long away from focus, say different space or minimised.
    – anki
    Commented Nov 25, 2019 at 2:14
  • Ah yes got it, thanks for the info! That's why I adviced to keep the focus on the Youtube tab so these kind of things would not occur :p
    – Gregordy
    Commented Nov 25, 2019 at 2:29
  • You can immediately confirm that a browser or video player application is successfully achieving this effect by opening MacOS's Activity Monitor, clicking on the Energy tab, Ctrl-clicking (or secondary-clicking) on the table's column headings, and enabling the "Preventing Sleep" column (this can also be enabled from the menu View>Columns>Preventing Sleep). You can now see if a browser or video player app's row has "Yes" displayed in the "Preventing Sleep" column.
    – Jacob C.
    Commented Mar 3, 2020 at 22:08
0

If you don't want it to sleep, just go to "System Preferences" then click "Energy Saver" then make your Mac's sleep auto to "Never". Then change it to "Normal" once download is done, Also one tip: attach the charger (or what ever you wanna call the charger I.E AC power etc.) while app/file/document/any other things are downloading.

If it's too complicated just go to "System Preferences" -> "Energy Saver" then set it to "Never".

0

Try NoSleep Application.

It is simple and has easy to use User Interface You can even close your lid and listen to music after that. Your App Store will continue downloading even after closing the lid.

0

I use https://keepingyouawake.app/ - it's free, open source, and lives in the menu bar where I can easily toggle it.

0

Apple's built-in caffeinate and pmset

To prevent sleep indefinitely run the following from the terminal:

caffeinate -sdi

To enable normal sleep again, terminate the utility with Ctrl+c.

If you want to prevent sleep while on battery and while the lid is closed then you need to run:

sudo pmset -a disablesleep 1

❗️ The effect of the command above will persist even after a reboot and  → Sleep will stay disabled. To revert back to normal sleep run:

sudo pmset -a disablesleep 0
1
  • There are many alternatives in other answers so if you say why you like that one and which similar apps here (or ones not mentioned here) you've tried, that would be helpful.
    – Poikilos
    Commented May 15 at 10:30
-2

just leave a video running like a 8 hour sleep music video

1
  • 2
    Welcome to Ask Different! We're trying to find the best answers and those answers will provide info as to why they're the best. Answers should be self-contained so explain why you think the answer you provided will solve the problem or is better than others out there. Providing links as supporting information can also help the OP, and others, find additional info for themselves. See How to Answer on how to provide a quality answer. - From Review
    – fsb
    Commented Aug 23, 2017 at 17:04

You must log in to answer this question.

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