# Mavericks is putting my app to sleep

**URL:** <https://forum.xojo.com/t/mavericks-is-putting-my-app-to-sleep/15643>\
**Category:** macOS\
**Created:** [April 9, 2014, 11:33pm UTC](https://forum.xojo.com/t/mavericks-is-putting-my-app-to-sleep/15643 "2014-04-09T23:33:04Z")\
**Posts on this page:** 13\
**Page:** 3

<div class="post-metadata">

**Author:** ![Sam\_Rowlands](https://forum.xojo.com/user_avatar/forum.xojo.com/sam_rowlands/32/265_2.png) [@Sam\_Rowlands](https://forum.xojo.com/u/Sam_Rowlands)\
**Post date:** [January 13, 2015, 2:25am UTC](https://forum.xojo.com/t/mavericks-is-putting-my-app-to-sleep/15643/41 "2015-01-13T02:25:05Z")

</div>

[quote=158828:@Albin Kiland]I realise this is an old thread awaken from the the other side…but, Sam, this seems to work!  
My app, that is a timer, was put to sleep if another app was run in Full Screen Mode…I’ll try to implement your solution and see what happens :)[/quote]  
What is it that your application does on a timed basis? If you can instead of using a timer, switch over to registering for system events. This will allow your app to sleep and make it more energy friendly.

---

<div class="post-metadata">

**Author:** ![James\_Cooksey](https://forum.xojo.com/user_avatar/forum.xojo.com/james_cooksey/32/5080_2.png) [@James\_Cooksey](https://forum.xojo.com/u/James_Cooksey)\
**Post date:** [August 10, 2015, 8:31pm UTC](https://forum.xojo.com/t/mavericks-is-putting-my-app-to-sleep/15643/42 "2015-08-10T20:31:13Z")

</div>

Sam, thanks for that. Solved the nightmare I was having with App Nap.

---

<div class="post-metadata">

**Author:** ![John\_Crook](https://forum.xojo.com/user_avatar/forum.xojo.com/john_crook/32/707_2.png) [@John\_Crook](https://forum.xojo.com/u/John_Crook)\
**Post date:** [March 6, 2016, 9:07pm UTC](https://forum.xojo.com/t/mavericks-is-putting-my-app-to-sleep/15643/43 "2016-03-06T21:07:40Z")

</div>

Another re-awakening of this old thread from the dead. However, it’s still popping up on Google so I thought I should update the information on preventing App Nap for El Capitan.

The terminal command to use now for preventing App Nap is:

```auto
defaults write com.mydomain.myappname LSAppNapIsDisabled -bool YES
```

You can verify that this instruction has worked by checking with ActivityMonitor\>Energy when you app is running.

---

<div class="post-metadata">

**Author:** ![Norman\_P](https://forum.xojo.com/letter_avatar_proxy/v4/letter/n/858c86/32.png) [@Norman\_P](https://forum.xojo.com/u/Norman_P)\
**Post date:** [March 6, 2016, 9:35pm UTC](https://forum.xojo.com/t/mavericks-is-putting-my-app-to-sleep/15643/44 "2016-03-06T21:35:36Z")

</div>

That will permanently disable it for your app  
That _may_ be less than ideal and really you should only block app nap when your app is doing something intensive  
Sams code in [https://forum.xojo.com/conversation/post/78698](https://forum.xojo.com/conversation/post/78698) makes that possible so you only disable it when you need to

---

<div class="post-metadata">

**Author:** ![John\_Crook](https://forum.xojo.com/user_avatar/forum.xojo.com/john_crook/32/707_2.png) [@John\_Crook](https://forum.xojo.com/u/John_Crook)\
**Post date:** [March 9, 2016, 4:14am UTC](https://forum.xojo.com/t/mavericks-is-putting-my-app-to-sleep/15643/45 "2016-03-09T04:14:37Z")

</div>

Thanks Norman. I’m going to need to look into this more deeply anyway. Despite seemingly having App Nap turned off, my App is still slowing to an unacceptable crawl after about 5 minutes under El Capitan.

---

<div class="post-metadata">

**Author:** ![Sam\_Rowlands](https://forum.xojo.com/user_avatar/forum.xojo.com/sam_rowlands/32/265_2.png) [@Sam\_Rowlands](https://forum.xojo.com/u/Sam_Rowlands)\
**Post date:** [March 9, 2016, 9:21am UTC](https://forum.xojo.com/t/mavericks-is-putting-my-app-to-sleep/15643/46 "2016-03-09T09:21:42Z")

</div>

I was going to mention that the last time I experimented, setting this with defaults or NSUserDefaults made no difference for me. The only way I found to get full speed is to use the NSProcessInfo with NSProcessInfo.NSActivityUserInitiatedAllowingIdleSystemSleep.

---

<div class="post-metadata">

**Author:** ![John\_Crook](https://forum.xojo.com/user_avatar/forum.xojo.com/john_crook/32/707_2.png) [@John\_Crook](https://forum.xojo.com/u/John_Crook)\
**Post date:** [March 9, 2016, 11:31pm UTC](https://forum.xojo.com/t/mavericks-is-putting-my-app-to-sleep/15643/47 "2016-03-09T23:31:06Z")

</div>

Thank you Sam. What would be the Terminal commands to achieve what you are suggesting please?

---

<div class="post-metadata">

**Author:** ![Norman\_P](https://forum.xojo.com/letter_avatar_proxy/v4/letter/n/858c86/32.png) [@Norman\_P](https://forum.xojo.com/u/Norman_P)\
**Post date:** [March 9, 2016, 11:53pm UTC](https://forum.xojo.com/t/mavericks-is-putting-my-app-to-sleep/15643/48 "2016-03-09T23:53:04Z")

</div>

The NSProcessInfo mechanism would be a bunch of declares you would have to call in your app  
Not command line commands

---

<div class="post-metadata">

**Author:** ![Sam\_Rowlands](https://forum.xojo.com/user_avatar/forum.xojo.com/sam_rowlands/32/265_2.png) [@Sam\_Rowlands](https://forum.xojo.com/u/Sam_Rowlands)\
**Post date:** [March 10, 2016, 1:58am UTC](https://forum.xojo.com/t/mavericks-is-putting-my-app-to-sleep/15643/49 "2016-03-10T01:58:56Z")

</div>

As far as I know there isn’t a terminal command, it has to be via declares. I posted the code earlier, or if you have the MBS plugin I’m sure Christian has added it.

---

<div class="post-metadata">

**Author:** ![John\_Crook](https://forum.xojo.com/user_avatar/forum.xojo.com/john_crook/32/707_2.png) [@John\_Crook](https://forum.xojo.com/u/John_Crook)\
**Post date:** [March 10, 2016, 3:32am UTC](https://forum.xojo.com/t/mavericks-is-putting-my-app-to-sleep/15643/50 "2016-03-10T03:32:39Z")

</div>

Thank you to both of you. I’m way out of my depth here (sigh!). I just want to get my app working full speed again like it did under Lion. Life seems to have suddenly become a lot more complicated!!

Sam, I looked at your example software NSProcessinfo-3, which Norman directed me to, but I have to admit that I don’t know enough to make any sense of it. Presumably I can just copy the elements into my app and simulate the checking and unchecking of the checkbox on initiation and exit? Would that work?

Thanks again for your help.

---

<div class="post-metadata">

**Author:** ![John\_Crook](https://forum.xojo.com/user_avatar/forum.xojo.com/john_crook/32/707_2.png) [@John\_Crook](https://forum.xojo.com/u/John_Crook)\
**Post date:** [March 10, 2016, 5:06am UTC](https://forum.xojo.com/t/mavericks-is-putting-my-app-to-sleep/15643/51 "2016-03-10T05:06:57Z")

</div>

YES!! I’ve just answered my own question. It’s work beautifully. Thank you so much Norman and Sam!!

---

<div class="post-metadata">

**Author:** ![Sam\_Rowlands](https://forum.xojo.com/user_avatar/forum.xojo.com/sam_rowlands/32/265_2.png) [@Sam\_Rowlands](https://forum.xojo.com/u/Sam_Rowlands)\
**Post date:** [March 11, 2016, 4:21am UTC](https://forum.xojo.com/t/mavericks-is-putting-my-app-to-sleep/15643/52 "2016-03-11T04:21:04Z")

</div>

Glad to hear you have it working 🙂

---

<div class="post-metadata">

**Author:** ![system](https://forum.xojo.com/uploads/default/original/1X/455b4dcc0e61630e9f81940004ddffa49c432a46.png) [@system](https://forum.xojo.com/u/system)\
**Post date:** [October 29, 2020, 5:10pm UTC](https://forum.xojo.com/t/mavericks-is-putting-my-app-to-sleep/15643/53 "2020-10-29T17:10:12Z")

</div>



[Previous page](https://forum.xojo.com/t/mavericks-is-putting-my-app-to-sleep/15643.md?page=2)
