-
Notifications
You must be signed in to change notification settings - Fork 429
Running SelfControl from the Terminal
Trevor Hartman edited this page Mar 10, 2017
·
8 revisions
In some cases, you may want to start a SelfControl block from the command line. This can make it much easier for advanced users to script their SelfControl blocks. This article explains how you can start SelfControl from the command line. If you're not familiar with the command line, this article is not for you.
- Install SelfControl into your Applications folder.
- Set your block preferences via the
defaultssystem. The key values you'll need to set areBlockDuration(length of the block in minutes),HostBlacklist(an array containing the list of hosts to block/whitelist), andBlockAsWhitelist(makes it a whitelist instead of blacklist). For example, a 60 minuteBlockDurationcan be set asdefaults write org.eyebeam.SelfControl BlockDuration -int 60. There are more preferences if you want them; you can see them by runningdefaults read org.eyebeam.SelfControl(or just configure them in the app's preferences panel). Don't setBlockStartedDate, that's handled by the program automatically. - Run
sudo /Applications/SelfControl.app/Contents/MacOS/org.eyebeam.SelfControl $(id -u $(whoami)) --installto start a block. It will automatically run checkups to see if the block needs removal every minute. - Wait for the block to expire. If you want to manually run a checkup to remove the block if necessary, you can do so with
sudo /Library/PrivilegedHelperTools/org.eyebeam.SelfControl $(id -u $(whoami)) --checkup. If that doesn't remove the block successfully, you can run our block removal tool with/Library/PrivilegedHelperTools/scheckup.
Example of configuring and running SelfControl:
defaults write org.eyebeam.SelfControl BlockDuration -int 120
defaults write org.eyebeam.SelfControl HostBlacklist -array facebook.com news.ycombinator.com
defaults read org.eyebeam.SelfControl
sudo /Applications/SelfControl.app/Contents/MacOS/org.eyebeam.SelfControl $(id -u $(whoami)) --install