Matt Rajca

blog projects github twitter email

Quickly Changing a Mac's Startup Volume with Alfred

May 10, 2012

As I work on projects in Snow Leopard, Lion and Windows, I constantly find myself switching my Mac's startup volume and rebooting. Utilities such as QuickBoot can streamline this process, though they're not very accessible and take up precious space in the menu bar. Why not leverage a keyboard-friendly launcher like Alfred instead?

Creating an Alfred extension that will change your Mac's startup volume and reboot the machine is trivial.

First, open Alfred's Preferences and switch to the Extensions tab. Under "Add an Extension to Alfred", select AppleScript. Enter a name for your extension (for example: "Reboot into Lion"), and press Create. Next, give your extension a title (which will appear in Alfred's search results), as well as a keyword like "reboot".

In the "AppleScript" text view, paste in the following script:

  
    on alfred_script(q)
        do shell script "bless -mount /Volumes/VOLUME_NAME/ -setBoot -nextonly" with administrator privileges
        tell application "Finder" to restart
    end alfred_script
    

Be sure to replace VOLUME_NAME with the name of the volume you wish to reboot into (as shown in the Finder). If the volume is a Boot Camp partition, include the -legacy flag as an argument to the bless command. Finally, hit Save to save your new extension. Create one such extension for each volume you want to have quick access to.

Alfred Extension

Toggling Alfred and typing "reboot" will now show the extension(s) among the search results. Invoking the extension(s) will prompt you for your password and reboot your Mac into the desired volume.