Last Updated: February 25, 2016
·
5.755K
· colindean

Enable the `at` command on OSX

It's really great to be able to set a timer of sorts by running a command at a certain time. The old at command does just this!

Unfortunately for OSX users, the service that processes at commands is disabled by default. So, let's enable it, reload it, and start scheduling commands.

atrun_plist=/System/Library/LaunchDaemons/com.apple.atrun.plist
sudo sed -i '' 's/true/false/g' $atrun_plist
sudo launchctl unload -F $atrun_plist
sudo launchctl load -F $atrun_plist

Now, you can schedule commands for a certain time, like so:

echo 'say Pomodoro is over. Take a break && growlnotify -s -m "take a break"' | at now + 25 minutes

echo 'heroku pipeline:promote && say "Site pushed to production on schedule"' | at 15:30

echo 'brew update && say Homebrew updated three days after that package you wanted was to be updated && brew upgrade that-package && say that-package updated from Homebrew' | at 4pm + 3 days

I find this super useful for reminders when combined with say or growlnotify.

References:

Note

I tried this on OSX 10.10 Yosemite. Behavior might change! To be sure, double check man 8 atrun to ensure that all you need to do is change the Disabled value to false and load atrun.