How To Add Cron or Cron-like Jobs To Mac (With MAMP or Otherwise)

The Mac runs on Unix, which makes it incredibly powerful. You might be running MAMP or a stand-alone version of Apache, and one of the things that you might want to run is cron, which is a scheduling tool. Instead of cron though, you could actually have your Mac just run a launch daemon.

Just go to terminal, and type:

cd /Library/LaunchDaemons/

Now type:

sudo vim yourfile.cron.plist

You’ll be asked for your administrator password, and after entering it, you’ll be brought to the vim screen. Press fn+i to go into insert mode. Now paste the following in:




Once done, press esc, and type :wq to save and quit.

This will actually create the property list file that will contain the information of the task that you want to run. Just paste in the following code, remembering to change “yourfile.cron” to your actual filename (notice this is the same as your filename, but without the .plist extension), and modifying the Program Arguments to fit your needs.

StartInterval is currently set at 1200, which is 20 minutes in seconds (20 minutes * 60 seconds). So if you want to, change this value too.

When you’re done editing, just hit esc, and type in :wq to write the file and quit. Now that the file is saved (you will probably need to enter your administrator password), just run the following commands to load the daemon:

sudo launchctl load /Library/LaunchDaemons/yourfile.cron.plist

Or unload the daemon:

sudo launchctl unload /Library/LaunchDaemons/yourfile.cron.plist

And there you have it – the way to run cron or cron-like jobs with your Mac!

Leave a Comment

Your email address will not be published.