Scheduling a task to repeat at a set interval I have written a Ruby script that I need to run every 12 hours. Is there an easy way to do this in OS X (specifically Lion)?
There are a couple of ways of doing this, but the details depend on a couple of questions: Does the script need to run as root (Admin) or a regular user?  Does it need to run on any specific schedule, or just a 12-hour interval?

The OS X-ish option is to create a LaunchDaemon.  Create a file named /Library/LaunchDaemons/local.scriptname.plist, with contents like this:

&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"&gt;
&lt;plist version="1.0"&gt;
&lt;dict&gt;
        &lt;key&gt;Label&lt;/key&gt;
        &lt;string&gt;local.scriptname&lt;/string&gt;
        &lt;key&gt;ProgramArguments&lt;/key&gt;
        &lt;array&gt;
                &lt;string&gt;/path/to/script&lt;/string&gt;
                &lt;string&gt;someargument&lt;/string&gt;
                &lt;string&gt;anotherargument&lt;/string&gt;
        &lt;/array&gt;
        &lt;key&gt;StartInterval&lt;/key&gt;
        &lt;integer&gt;43200&lt;/integer&gt;
        &lt;key&gt;RunAtLoad&lt;/key&gt;
        &lt;false/&gt;
        &lt;key&gt;KeepAlive&lt;/key&gt;
        &lt;false/&gt;
&lt;/dict&gt;
&lt;/plist&gt;


Notes: 43200 is 12 hours in seconds, meaning that this will every 12 hours starting at boot.  You should replace scriptname with a more appropriate identifier in both the Label value and the filename (and if you're going to publish this, replace "local." prefix with your domain name in reverse order, e.g. "example.com.scriptname").  If it should run as someone other than root, add:

        &lt;key&gt;UserName&lt;/key&gt;
        &lt;string&gt;usertorunas&lt;/string&gt;


If you need it to run at particular times of day, replace the StartInterval key and value with something like this:

        &lt;key&gt;StartCalendarInterval&lt;/key&gt;
        &lt;array&gt;
                &lt;dict&gt;
                        &lt;key&gt;Hour&lt;/key&gt;
                        &lt;integer&gt;6&lt;/integer&gt;
                        &lt;key&gt;Minute&lt;/key&gt;
                        &lt;integer&gt;0&lt;/integer&gt;
                &lt;/dict&gt;
                &lt;dict&gt;
                        &lt;key&gt;Hour&lt;/key&gt;
                        &lt;integer&gt;18&lt;/integer&gt;
                        &lt;key&gt;Minute&lt;/key&gt;
                        &lt;integer&gt;0&lt;/integer&gt;
                &lt;/dict&gt;
        &lt;/array&gt;


...replacing Hours 6 and 18 (6pm) with the hours you want it to  run.

The other option is to use cron, which is more generic-unix (but works fine on OS X).  Use the command crontab -e to create/edit the crontab file.  The crontab will be created for whichever user you create it with, so if your script should run as root, use sudo crontab -e.  The crontab should look something like this:

0       6,18       *       *       *       /path/to/script someargument otherargument


Note that there's no equivalent of StartInterval here, this always runs it at 6am and 6pm.