
Similarly, you can modify the settings using defaults write. You can see these either using the selfcontrol app or from the command-line using defaults read Selfcontrol will run with the current settings. The advantage of running Selfcontrol as a root cronjob is that this way it already has "administrator rights" (root access), and there is not need to give it an administrator's password. Btw, by default, you will be editing the crontab file using vi, so you can save the file using ZZ, for example. You can add as many crontab lines as you like to schedule arbitrary commands to run at different times. If you wanted to automatically run selfcontrol from 8:30am Monday-Friday then the start of the crontab line would be 30 10 * * 1-5 /Applications/. Where XXXX is the number you obtained in the first step. # Run self-control at 11pm every day for user XXXX = $(id -u $USER)Ġ 23 * * * /Applications/SelfControl.app/Contents/MacO/ XXXX -install Now add the following lines (the first two lines are comments explaining the last line): # Cron syntax: minute hour day_of_month month day_of_week
Selfcontrol mac password#
You will be prompted for your password and this will only work from an administrators' account. Next open the root crontab file with sudo crontab -e To do this first type id -u $USERĪnd remember the number, Say XXXX. This has to be done from the terminal by someone with administrator privileges. If you want your computer back, replace load in the above command with unload, then wait for the remaining SelfControl time to expire.Īnother option is to set up a cronjob for selfcontrol. Since it's in ~/Library/LaunchAgents it will be loaded automatically when you log in. This will tell launchd to open the AppleScript and start SelfControl for twenty four hours every twenty four hours. Load the launchd entryįinally, open a terminal and run: launchctl load ~/Library/LaunchAgents/my. If the Library folder is hidden, you can open Finder, press Cmd Shift G and paste ~/Library to open it. plist extension under /Users/your-username/Library/LaunchAgents/my.
Selfcontrol mac mac os x#
Then open your favourite text editor or the Property List Editor.app that comes with the Mac OS X Dev tools on Snow Leopard or is integrated into Xcode on Lion.Įither way, paste the following contents, but make sure to change the path to the script accordingly (it't the one we remembered above): Users/your-username/SelfControl.scpt, which would be in our home folder. Now, from AppleScript Editor, save this file somewhere by pressing File » Save, e.g. 24 hours) here so you can automatically kick off SelfControl for the maximum time. Set value of text field 2 of scroll area 1 of group 1 to myPass Tell slider of window "SelfControl" to set value to myTimeĬlick button "Start" of window "SelfControl" Tell application "SelfControl" to activate

Set myPass to do shell script "echo " & x & " | perl -pe 's/]//g'"

eliminate invisible characters, or "gremlins," from password Set myPass to (password of first generic item ¬ Tell application "Usable Keychain Scripting" Paste the following contents (originally from here)to a new window of AppleScript Editor.app: on run argv Click 'Add', and you should now have a new application password entitled 'SelfControl' in your Keychain. Under Keychain Item Name, type 'SelfControl.' Make up any Account Name in the next field, and in the Password field, type the password for your user account (the password you would use to authenticate anything in OS X). Create a new password by typing Cmd-N or going to File » New Password Item.
Selfcontrol mac install#
You'll need to download and install Daniel Jalkut's Usable Keychain Scripting to quickly and securely access your admin password in order to activate SelfControl.

Then, SelfControl will always start up when you log in. Either drag and drop SelfControl into the list, or click the "+" button and navigate to its location.

Simply open System Preferences from the /Applications folder, select "Accounts" and, with your user name highlighted in the list to the left, select the "Login items" tab.
