Restart an app if it is force quit
There is! launchd.info's cookbook has an example to keep Safari open. We can amend that to suit your, uh, anti-procrastination needs. Amending the original (Safari) version results in:
<?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>KeepAlive</key>
<true/>
<key>Label</key>
<string>local.freedom.keepAlive</string>
<key>ProgramArguments</key>
<array>
<string>/usr/bin/open</string>
<string>-W</string>
<string>/Applications/Freedom.app</string>
</array>
</dict>
</plist>
Save that as ~/Library/LaunchAgents/local.freedom.keepAlive.plist
. Check the last <string>...
line - is that where Freedom
is on your Mac? Edit the file if necessary and re-save it. Then use launchctl
to load your anti-procrastination launch agent into launchd
:
launchctl load ~/Library/LaunchAgents/local.freedom.keepAlive.plist
Check your launch agent is running with:
launchctl list | grep freedom
And finally - try quitting Freedom
. If all goes well your attempt to procrastinate should be thwarted.