Is there a simple way / app to say for example: every 30 minutes lock computer for 5 minutes (and don't let any easy way to cancel while this 5 minutes break is happening)?

I know you can set a daily use time, and i know you can schedule locking time. but those are not what i am looking for.


This ought to be in a comment. No enough reps

Please clarify: a. You want to enforce locking after 30 minutes of Desktop session?

Answered Here https://stackoverflow.com/a/6445525. Automator.app is the tool of choice. use the command:

sudo shutdown -s +30

b. Gently remind the user to lock screen after 30 minutes and take a break?

for b. these are the possibilities: Setup a reminder with a Timer app. Use Key chain access/ Hot Corners/ or Add an icon to the dock.

| improve this answer | |
  • I edited my question because i forgot to mention i need it to stay lock for 5 minutes or so, but for your question it's more similar to the option a you mentioned. – mondi Feb 7 '19 at 10:42
  • Stay locked for 5 minutes and then resume again? Automatically unlocking a locked session beats the purpose it was designed for - security, that is. – Kavera_user714152 Feb 7 '19 at 10:45
  • Didn't really understand you. first of all the purpost is not secuirity at all. second, it can be resumed to the login screen state so you need the password. – mondi Feb 7 '19 at 10:52

One way to do this is to set a cron job that activates the ScreenSaver App which ends up locking your screen.

Reproducing the relevant snippet from this repo on Github

# Written by Amar Sharma <amarsharma.hacker@gmail.com>

lock_screen() {
  sudo open -a /System/Library/Frameworks/ScreenSaver.framework/Versions/A/Resources/ScreenSaverEngine.app || true

A friend of mine made this script that come night time will change your password and lock your mac every X minutes and email you the password to make it cumbersome to continue using your mac every day. Link to Source Code on Github

| improve this answer | |
  • Thanks, i was looking for a more simple solution (no coding :), but any way how can i use this code to repeat this every 30 minutes? – mondi Feb 7 '19 at 10:36
  • Also i edited my question because i forgot to mention i need it to stay lock for 5 minutes or so. – mondi Feb 7 '19 at 10:41
  • I see, what if, this same script had the following behavior: 1. Lock and change password to random string every 30 minutes 2. Change password back to old password after 5 minutes – Sinstein Feb 7 '19 at 15:14
  • That could be fine... i guess. how would you do it? – mondi Feb 7 '19 at 18:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.