2

In macOS High Sierra v 10.13.4, I can do the following in Parental Controls:

  • Entirely disallow the use of specific apps in the Apps tab's Limit Applications on this Mac option.
  • Limit the entire use of the computer in the Time tab.

However, what I would like to do is limit how long a specific app can be used. In particular, I'd like to limit my kid's use of a specific game to x hours per day, but the above options do not permit that.

Is there a way to do this using macOS itself? If not, is there another way to do this, either with another app, through the command line, or otherwise?

(This similar question with respect to Mac OS X 10.10 references an app called Watcher, but that got poor reviews and doesn't appear to have been updated recently.)

  • Interesting workaround here ask.metafilter.com/243437/…. Basically create new account with only that application and use parental controls to limit time on that account. When your kid would like to use the application they login to that account. – JBis Jun 8 '18 at 3:02
  • Also, to what degree do you need the security to be. I have some solutions in mine but they are easily bypassible with some computer knowledge. I doubt that your kid(s) would be able to bypass it (depending on their age) but would just like to make sure. – JBis Jun 8 '18 at 3:04
  • Lastly how many games? If more then 1 do you need different times for each one, the same time for each one, or a cumulative timer? – JBis Jun 8 '18 at 3:16
3

Note: I myself am a kid too, hopefully others don't see me as a traitor for providing this answer 🤣🤣

Heres the start of my application. It is a work in progress. I will be editing very soon to include may new features such as

  • Remote editing of settings (like parental controls allows you to do)

  • Ability to get alerted if the kid tries to bypass the restriction

  • Ability to extend time (reward system?) with a parental password

  • Ability to bypass restriction completely with parental password

  • Multiple Alerts

  • More Logs

  • More comments in code

  • LaunchAgent and LaunchDemon

  • Many more features

Open this in Script Editor and export it as a read-only application and make sure stay open after run handler is checked off

After exporting follow this guide to prevent it from show up in the dock.

To quit, go to Activity Monitor, search for what ever you saved the application as and press the X in the upper left hand corner of the window.

 ## Time Limiter - Created by Josh Brown - Created June 8th 2018 - Last Modified June 8th 2018 ##
global applist
global timelimit
global timelimits
global day1
global day2


## Settings ##
set applist to {"Google Chrome", "App Store"} -- Apps to limit
set timelimit to 10 -- time to limit in min, this is cumulative between all application
set alert1 to 5 -- time when to give a warning (great for giving a 5 min warning so they know they should save and wrap up what they are doing)

## Alert Settings ##
set alertme to false
set bypassattempts to 0
set maxbypassattemtps to 3 -- If the kid trys to reopen application after timelimit has expired alert you

## Bypass/Extention Settings ## -- If you would like to give the kid an extesion or bypass the block
set allowbypass to false
set pass1 to ""



set timelimit to timelimit * 60 -- Make into a seconds
set alert1 to alert1 * 60

set timelimits to timelimit

on is_running(appName)
    tell application "System Events" to (name of processes) contains appName
end is_running

on checkapps()
    set x to false
    repeat with a from 1 to length of applist
        set b to item a of applist
        if is_running(b) then
            set x to true
        end if
    end repeat
    return x
end checkapps

on killall()
    tell application "System Events"
        repeat with myProcess in applist
            set theID to (unix id of processes whose name is myProcess)
            try
                do shell script "kill -9 " & theID
            end try
        end repeat
    end tell
end killall

on logme(msg)
    set time1 to do shell script "date"
    do shell script "echo \"" & msg & " " & time1 & "\" >> ~/Library/Logs/Time_Limit.log"
end logme

on checkday()
    if day of (current date) is not equal to day1 then
        set timelimit to timelimit + timelimits
        set day1 to day of (current date)
    end if
end checkday

logme("Begin Timer with Apps List: " & (applist as string))
set day1 to day of (current date)
repeat while 1 = 1
    checkday()
    if checkapps() then
        if timelimit > 0 then
            set timelimit to timelimit - 1
            if timelimit is alert1 then
                logme("Time Left:" & (timelimit as string) & "Displaying alert")
                display notification "Please finsh what you are doing and save your work" with title "Time Limit Almost Up" subtitle ((timelimit * 60) & " Minitues remaing") as string
            end if
        else
            (*
            tell application app1
                quit
            end tell
            delay 20
            *)
            if checkapps() then
                killall()
                logme("App Runnning after Limit, Killing")
            end if
        end if
    end if
    delay 1
end repeat
  • Very nice! This could very well do the trick, except for the manual step of restarting the app daily, which I'm bound to drop the ball on sooner or later. Once you change it so this is "set it and forget it", it looks like it'll do what's needed. – Vincent Jun 9 '18 at 5:13
  • 1
    @Vincent I edited. It should now reset the timelimit at 12:00am. – JBis Jun 9 '18 at 14:56
  • 1
    @Vincent Please note, this script is extremely easily bypassible. Changing the date, renaming the executable & opening it, etc. Will all bypass this system. I am relying on the fact that your kids are too young to figure this out. – JBis Jun 9 '18 at 14:57
  • Thanks, Josh! They're old enough to be learning coding, but they've yet to do any AppleScript, so there's definitely a chance they'll figure out how to bypass this but it'll take some time for them to figure it out. We just ordered a new computer and I'll test this out on there once it arrives. – Vincent Jun 9 '18 at 15:50
  • @Vincent I will edit my answer to provide ways to prevent them from bypassing the restrictions. For example, locking down system preferences so date can’t be changed without admin password, making account only have read permissions application so they can’t do change name of executable. You can also export as a read only to prevent them from changing code. – JBis Jun 9 '18 at 16:07

You must log in to answer this question.

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