Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

cbsvitzer

macrumors newbie
Original poster
Jul 27, 2025
7
2
My Mac Mini M1 with Monterey 12.7.4 has a problem
After a while the screen turns off no matter what I do in the settings
Så I want to launch caffeinate automatically when the computer boots
I've put the following .plist file into the folder: ~/Library/LaunchAgents

<?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>Caffeinate</string>
<key>ProgramArguments</key>
<array><string>>/usr/bin/caffeinate -d -t 20000</string></array>
<key>RunAtLoad</key>
<true/>
</dict>
</plist>

But when it has booted up, caffeinate is not running according to Activity Monitor
Could anyone tell me what to do to run caffeinate so I don't have to launch it in Terminal?
 
Last edited:
Can't you just add the application in the system settings/Login items?
1753874657127.png
 
Yes, I can launch caffeinate through Login Items
But then I can't specify the arguments: -d -t 20000 and it doesn't work properly
 
Last edited:
Does it change if you remove the > :

<array><string>>/usr/bin/caffeinate -d -t 20000</string></array>
 
Does it change if you remove the > :

<array><string>>/usr/bin/caffeinate -d -t 20000</string></array>
If I remove the arguments "-d -t 20000" so the line becomes:

<array><string>>/usr/bin/caffeinate</string></array>

then caffeinate starts up automatically
But how do I include the arguments?
 
Like this:
Code:
<?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>Caffeinate</string>
    <key>ProgramArguments</key>
    <array>
        <string>/usr/bin/caffeinate</string>
        <string>-d</string>
        <string>-t</string>
        <string>20000</string>
    </array>
    <key>RunAtLoad</key>
    <true/>
</dict>
</plist>
 
Like this:
Code:
<?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>Caffeinate</string>
    <key>ProgramArguments</key>
    <array>
        <string>/usr/bin/caffeinate</string>
        <string>-d</string>
        <string>-t</string>
        <string>20000</string>
    </array>
    <key>RunAtLoad</key>
    <true/>
</dict>
</plist>
Thanks a million :)
That works perfectly
 
  • Like
Reactions: bogdanw and ab22
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.