How to easily switch between startup volumes

12.01.2015
Reader Robert Kapp would like a shortcut for a tedious task. He writes:

I haven't fully committed to running OS X Yosemite on my Mac, but I do it often enough that I find myself having to change from my Mavericks startup disk to the Yosemite disk every couple of days. Is there a faster way to do this than through the Startup Disk system preference

There is. I bounce between a couple of startup volumes each day and, like you, I find the required journey to this system preference a little tiresome. Because I do, I've created an AppleScript application that goes a little something like this (copy and paste it into the AppleScript Editor app):

do shell script ¬

¬

"bless -mount \"/Volumes/name of volume\" -setBoot" with administrator privileges

tell application "Finder"

restart

end tell

Replace "name of volume" with the name of the drive you want to boot from. For example, if you're running the script from your Mavericks volume (which you've named "Mavs") and want to boot from the Yosemite volume you've named "Macintosh HD," the first bit would read:

"bless -mount \"/Volumes/Macintosh HD\" -setBoot" with administrator privileges

The first bit of the script asks for your administrator password so that it can change startup volumes. The restart command is there to ensure that you're prompted to save any unsaved changes in open applications before the Mac restarts.

You'll want to create two copies of this--one for the Mavericks volume to boot into Yosemite, and another for the Yosemite volume to boot into Mavericks. Save each one as an application and place them on the appropriate drive. When you're ready to switch, just double-click the appropriate copy of the app you created.

If you'd like to tart up the script a bit when moving from Yosemite to Mavericks, you could try the following:

property targetVolumePath : "/Volumes/name of volume"

set AppleScript's text item delimiters to "/"

set targetVolumeName to last text item of targetVolumePath

set AppleScript's text item delimiters to ""

set dialogPrompt to "This script will reboot this computer to volume "" & targetVolumeName & ""." & return & return

do shell script "bless -mount " & (quoted form of targetVolumePath) & " -setBoot" with prompt dialogPrompt with administrator privileges

tell application "System Events"

restart with state saving preference

end tell

This takes advantage of two AppleScript features introduced with Yosemite--the "with prompt" parameter and the "save state" option. The first allows us to create the prompt that tells you what will happen when the app runs. The second allows you to configure how things are saved when the app restarts or shuts down your Mac.

(www.macworld.com)

Christopher Breen