56

The Caffeine app for preventing sleep/screen lock is not working on macOS Mojave.

Did I miss a setting to FAQ on making it work with macOS 10.14?

10
  • Welcome to Ask Different. The way your question is currently written, it could be closed as off-topic. You can help prevent this from happening by editing your question to include the problem you're having and what you've already done to resolve it. For example, what alternatives to Caffeine did you try and why didn't they work for you?
    – fsb
    Commented Sep 25, 2018 at 17:16
  • Have you tried Caffine app for the Mac? lightheadsw.com/caffeine
    – Natsfan
    Commented Sep 25, 2018 at 17:26
  • 2
    @jmh not working on mojave
    – charlie137
    Commented Sep 25, 2018 at 17:36
  • 1
    What do you mean by „not working“? Does is it not start, does it not prevent sleep? Did you check the man page tinder whether parameters changed?
    – nohillside
    Commented Sep 25, 2018 at 17:53
  • Caffinated is a maintained app that was last updated in Sept, 2018 so it may support Mojave. Is $1 at the app store. But i have no idea if it will work.
    – Natsfan
    Commented Sep 25, 2018 at 18:24

6 Answers 6

46

TLDR: Access to the permissions in Mac OSX Mojave have changed. You have two options:

  1. Download updated version of Caffeine that I fixed. See story below.
  2. Update preferences to allow Caffeine access it needs. (via other answer to this question)

While this question wasn't entirely clear on whether the issue was with the caffeinate command built in to macOS or the Caffeine utility written by Tomas Franzén of Lighthead Software, the comments and other answers seem to imply the latter.

After encountering the issue myself, I reached out to Tomas and inquired about taking over the development of Caffeine. He graciously has provided the source code under an MIT license, and I've made a quick updated version available here that will prompt for the needed accessibility permissions when running on Mojave.

I will be bringing additional support for Mojave as well as some improvements in the near future, but wanted to put this here for others who come across this question like I did and would like to continue using Caffeine.

6
  • @charlie137 I see that following Beau Smith's edit to this answer, you have since removed it as the accepted answer. Was there a problem with the edit? Given that there is now a released version of Caffeine supporting macOS Mojave, this would indeed answer the question at hand.
    – TuxToaster
    Commented Dec 5, 2018 at 3:26
  • 7
    would you please fix the persistent blue highlight when right clicking on the menu bar icon ? Commented Jan 24, 2019 at 19:13
  • I am using the new version AND have added it to my Accessibility settings - and still it isn't working. As far as this being open sourced - I tried to look for a github repo to no avail - can you point me to that and maybe I can look into the problem/fix myself? Commented Feb 25, 2019 at 3:37
  • 4
    for others looking it is here: github.com/tomasf/caffeine
    – Justin
    Commented Apr 4, 2019 at 2:39
  • 1
    Thanks @Justin, I had missed the earlier comment from Justin Phiony asking about that. That repo is indeed the one that Tomas uploaded when I inquired about Caffeine, and what I based the current version on. I didn't get a chance to post the updated repo with my fixes and new features, but I'll do that soon and add a comment here with the link.
    – TuxToaster
    Commented Apr 5, 2019 at 13:53
58

Caffeine is still working! However, Apple has upped its security and privacy model a bit and caffeine fell prey to that. What you have to do to get it working properly again is the following:

  • Open System Preferences
  • Click Security & Privacy
  • Click the Privacy tab
  • In the left column, select Accessibility
  • If needed, click the lock icon in the lower left and enter your password to unlock your settings
  • Click the + button and select your Caffeine app to allow it to control your Mac
  • Restart Caffeine

System Preferences screenshot

1
  • +1 Great fix, this worked for me! Why change to an alternative when the original one still works! Commented Oct 19, 2018 at 16:01
19

Here are 2 alternative you can try that do the same as caffeine.

Amphetamine, a full-on Caffeine replacement

and

KeepingYouAwake, an up-to-date Caffeine clone

4
  • 3
    I have tried both of these, and they work well. I prefer the Amphetamine, for reasons I can't remember now, but I'd definitely recommend checking them both out.
    – TJ Luoma
    Commented Sep 25, 2018 at 19:09
  • 2
    +1 for KeepingYouAwake. Using since Sierra and just upgraded to Mojave. Works like a charm.
    – Nimesh Neema
    Commented Sep 26, 2018 at 4:32
  • +1 as well for KeepingYouAwake. Quality software. Commented Oct 12, 2019 at 23:30
  • Also: github.com/domzilla/Caffeine for Sonoma
    – Ivan Chau
    Commented Dec 26, 2023 at 14:20
12

AFAIK, caffeinate remains in Mojave, and it is certainly in High Sierra and Mojave. caffeinate is a command line utility; i.e. you invoke it from the terminal. If this is what you mean by "manual entry" then I'll guess you're not keen on doing things from the command line.

However, caffeinate is quite easy to use. It also has the advantage of being supported by Apple, doesn't require cluttering your system with additional apps that will require your time to maintain/upgrade. I could go on, but...

So that's my answer. I mostly just wanted to make it clear that the caffeinate utility has not been deprecated by Apple.

EDIT:

Note that caffeinate will NOT prevent an automatic logout. Check to make sure you have not selected that option; caffeinate is powerless against a logout.

7
  • Just be sure to spell it correctly. i looked for it earlier and spelled it caffinate which looks ok but is wrong. Seamus spelled it correctly as caffeinate..
    – Natsfan
    Commented Sep 25, 2018 at 20:58
  • No, manual entry would be script/copy-paste one-liner. I was looking for the same app like Caffeine, that wasn't updated since 2009. And it finally just lost its magic on mojave.
    – charlie137
    Commented Sep 26, 2018 at 6:43
  • I believe, and could of course be mistaken, that Caffeine is just a GUI wrapper for caffeinate.
    – Br.Bill
    Commented Nov 20, 2018 at 22:20
  • 1
    I tried caffeinate but it doesn't work for my use-case. I have a malfunctioning Hall effect sensor that spuriously signals clamshell closed at random but even with caffeinate, it still goes to the lock screen. Trying KeepMeAwake.
    – dhchdhd
    Commented Feb 2, 2019 at 20:48
  • @Barry: Not sure, but lock screen and sleep may be different things??
    – Seamus
    Commented Feb 3, 2019 at 0:39
0

Hey there—I’m the creator of an alternative called Theine. Back in 2015 I’ve decided to create my own caffeine-like app because of the lack of support for retina displays.

▶ Download: https://itunes.apple.com/app/theine-2/id955848755

It’s available on the Mac App Store and doesn’t require Accessibility (== admin) privileges at all.

enter image description here

0

Below will start caffeinate -s supported by Apple as a macos launchctl daemon on computer startup.

; cat >~/ze.caffeinate.plist <<'EOF'
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>Label</key>
    <string>ze.caffeinate</string>
    <key>ProgramArguments</key>
    <array>
        <string>/usr/bin/caffeinate</string>
        <string>-s</string>
    </array>
    <key>KeepAlive</key>
    <true/>
</dict>
</plist>
EOF

; sudo mv ~/ze.caffeinate.plist /Library/LaunchDaemons/

; sudo launchctl load /Library/LaunchDaemons/ze.caffeinate.plist
...

; sudo launchctl list |grep caffeinate                          
4921    0   ze.caffeinate

You must log in to answer this question.

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