I was trying to achieve this using a second account (which is the admin account) and Parental Controls, but it seemed this isn't possible to do so.
I know there are some programs which you can download that help you with this, (Cold Turkey, for example). But, it would be much easier if I could do this using only tools already available on macOS.
Best Answer
You can do this with two built in tools:
Gatekeeper
Using Gatekeeper, we can create "rules" that allow you to block/enable apps. Using your example, we can create a list of Apps that is only allowed to run on Fridays:
The benefit of this, is that you can add multiple apps with the same label and enable/disable them in one single command:
Launchd
For this you will need a simple script to enable/disable the apps and you need to run this as a daemon (needs
sudo
privilege) so it has to reside in/Library/LaunchDaemons
.I used the naming convention
com.user.FridayApps.plist
andFridayApp.sh
for the script.Bash Script:
Launchd
.plist
How this works
What's happening here is two things:
launchd
is running a script twice. Once at the time to run it on and another time to turn it off