Since upgrading to Lion, I have seen a sleight decrease of productivity when it comes to using iCal. As a result, I am trying alternatives such as BusyCal. The application seems great, however I cant set an alarm to run a script as I could in iCal.

Hence, I want to become independent from iCal and have an AppleScript run everyday without having to keep iCal running. Any idea of how to do this?


You can run a cronjob using crontab.
So basically, to run a cronjob, you will need to type nano ~/crontab in Terminal. This will create a new file called "crontab" in your home folder, and open up a simple text editor in Terminal. Type:

* * * * * osascript ~/Desktop/theScriptToBeExecuted.applescript

This will run an AppleScript named "theScriptToBeExecuted.applescript" located on your desktop, every minute. The five "*" before the osascript command specify the time. Here's a table to show you what each field stands for:

*     *     *   *    *        command to be executed
-     -     -   -    -
|     |     |   |    |
|     |     |   |    +----- day of week (0 - 6) (Sunday=0)
|     |     |   +------- month (1 - 12)
|     |     +--------- day of        month (1 - 31)
|     +----------- hour (0 - 23)
+------------- min (0 - 59)

So to run the same command at one minute past midnight (00:01) of every day of the month, of every day of the week, type this in the file:

1 0 * * * osascript ~/Desktop/theScriptToBeExecuted.applescript

If you need more info, check out this article on cron.

To save the file that you're working on, type Control+X (exits), then Y (tells Terminal that you do want to save the file), then Enter Now type at the prompt cron ~/crontab This tells cron that it should be looking at the crontab file, if your file is named "crontab" in your home folder.

Another alternative is Cronnix It's a GUI for crontab.

Script Timer is similar, but it runs specified AppleScripts at specified times. It's a little easier to use, but it costs $12. I would recommend just going with Cronnix (free) or crontab (also free!)

  • how would i use that utility to do what I am trying to do? – finiteloop Sep 13 '11 at 1:32
  • 1
    Do you want to add the condition: without using terminal? – GEdgar Sep 13 '11 at 1:40
  • No, I'm fine with using the terminal. I'd like to add the condition: without spending a great deal of time learning a command line utility. – finiteloop Sep 13 '11 at 1:43
  • @segfault Sorry, I was typing it up and I posted the answer before I was done. – daviesgeek Sep 13 '11 at 1:47
  • @segfault NP! Glad to help! – daviesgeek Sep 13 '11 at 2:30

In recent versions of OS X launchd is preferred to cron. Here's an excerpt from man crontab under Mavericks:

Darwin note: Although cron(8) and crontab(5) are officially supported under Darwin, their functionality has been absorbed into launchd(8), which provides a more flexible way of automatically executing commands.

You can control launchd using the built-in launchctl but many people (including me) use a GUI called Lingon.

UPDATE: I now use LaunchControl instead of Lingon. It's a lot more powerful, though the interface is more complicated.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .