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

Ruskes
  • 48,129
Rahul
  • 601

13 Answers13

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.

0942v8653
  • 7,412
  • 2
    Best answer so far, so handy for terminal lovers! Gonna try it now. – Akash Agarwal Dec 23 '16 at 08: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 Dec 29 '17 at 16:09
  • 1
    It needs to have the -s flag to prevent downloads from stoping. – user7886229 Jun 25 '18 at 01: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 Sep 24 '21 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 Jul 05 '23 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

Tetsujin
  • 115,663
  • 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 May 13 '16 at 04: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 May 13 '16 at 19:17
  • The panels have changed and this is no longer accurate. Use "Energy saver" panel. – BondedDust Feb 21 '18 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 Feb 21 '18 at 19:27
  • Color me puzzled. I'm on El Cap too, but I don't get that graphic. – BondedDust Feb 21 '18 at 19:29
  • Well, we've lost the Skeuomorphic look since I posted this answer, but the control is in the same place. I mean, I could swap the picture for one with 'flat dots', but the rest is identical - even the tiles in the pref pane. – Tetsujin Feb 21 '18 at 20:13
  • Ah. I see it now, but those choices don't seem to respond to the request to modify the time interval to "sleep"-mode. It would require remembering to use one of hte active corner toggles, and if the questioner is anything like me they will not routinely remember to add that to their download sequence of actions. – BondedDust Feb 21 '18 at 22:43
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.

Indego
  • 81
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.

Graham Miln
  • 43,776
hiru
  • 313
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.

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.

Brick
  • 1,023
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.
user3439894
  • 58,676
dolphin
  • 41
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.

Gregordy
  • 121
  • 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 Nov 24 '19 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 Nov 25 '19 at 02:01
  • 1
    Oh that happens when YouTube is long away from focus, say different space or minimised. – anki Nov 25 '19 at 02: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 Nov 25 '19 at 02: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. Mar 03 '20 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".

klanomath
  • 66,391
  • 9
  • 130
  • 201
Louis
  • 1
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.

Graham Miln
  • 43,776
Boyka
  • 33
0

After having tried a couple of similar apps I settled on InsomniaX — a free and open-source app that allows sleeping the screen while keeping the system on. The only annoyance I've found is that once in a while it asks for the user's password.

Installable via homebrew with:

brew cask install insomniax
ccpizza
  • 2,995
  • 3
  • 36
  • 41
0

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

Ben
  • 101
  • 2
-2

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

ass
  • 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 [answer] on how to provide a quality answer. - From Review – fsb Aug 23 '17 at 17:04