This script checks every five minutes (configurable) to see if you're on a specified safe network, such as your home network. If you are, it disables the "Require password X seconds after sleep or screensaver begins" preference on a Mac. If it can't find that network, it enables that lock preference.
In practice, this means your computer will require a password when you're out and about, but not force you to enter your password over and over again at home.
- Download the latest files from here.
- Put
autolock.sh
anywhere you like, but remember where you put it. - Inside
autolock.sh
, replaceDeath Star
on the first line with the SSID (name) of your home network.- Alternatively, change your network name to
Death Star
.
- Alternatively, change your network name to
- In
com.edwardloveall.autolock.plist
, replace thepath/to/autolock.sh
with the path to the script in the previous step. - Move the launchd plist to
~/Library/LaunchAgents
. If you don't have theLaunchAgents
folder, you can just create it. Spelling and capitalization are important. - Install and start the launchd job with
launchctl load -w ~/Library/LaunchAgents/com.edwardloveall.autolock.plist
Read more about this in my blog post: https://blog.edwardloveall.com/automatically-lock-your-computer-based-on-wi-fi