Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need to test some software (nightly) on 3 Mac OS X versions: 10.4, 10.5, 10.6 -- the software interfaces with the hardware, so non-native solutions (like virtualisation) are not ideal.

So I figured the best way to test the software (which is automatic by the way) is to have a partition for each version of the OS. This way I can boot to a specific version to test the software.

This needs to be done on a timed schedule, so I was hoping I could run a command like this in a crontab:

reboot --to "Mac OS X 10.5"

Is something like this possible, or do I need to write my own software to do this?

share|improve this question
up vote 7 down vote accepted

I am not aware of any application that can do this, but doing some research there is 2 suggestions.

Firstly use AppleScript to select the startup disk. The basic idea is using the following you can select the boot partition and then reboot.

do shell script "bless -mount \"/Volumes/Name of the drive\" -setBoot" with administrator privileges do shell script "shutdown -r now" with administrator privileges.

You can then use osascript to execute the above AppleScript from your crontab.

Alternatively you can install rEFIt which allows you to select an OS at boot, and potentially modify the startup files using a bash command which can change the default OS to boot. I have no way to confirm this can be done but it is an option.

The above is shown as an AppleScript, and since the source article refers to it I am keeping it in the original format, however as was pointed out in the comments, the two commands can be run in the shell directly without needing AppleScript

share|improve this answer
There's no reason to (and good reasons not to) use a shell script to run AppleScript to run a shell script... This is especially likely to fail when run from crontab. Instead, just put bless -mount "/Volumes/Name of the drive" -setBoot && shutdown -r now directly in a shell script, and run that via crontab. – Gordon Davisson Oct 21 '10 at 21:28
@Gordon Davisson This should be an answer; I would have accepted it. I will accept Diago's instead. – nbolton Dec 4 '10 at 15:04
I found one caveat; you'll need to run it as the root user. – nbolton Dec 4 '10 at 15:05

The nvram command will allow you to modify the NVRAM parameter that specifies which partition to boot from.

share|improve this answer
Although it looks like bless as given in Diago's answer will do a better job of it. – Ignacio Vazquez-Abrams Oct 21 '10 at 19:03

You must log in to answer this question.

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