Apple script: How to boot to other volume

Posted on 2009-02-20
Last Modified: 2012-05-06
I need snippet to boot to other volume such as 'TEST'
Question by:myang999

    Author Comment

    I need Apple script snippet to boot to other volume such as 'TEST'.
    For example, I am in volume '10.5' and want to boot into volume 'Test'.
    LVL 39

    Expert Comment

    Are you talking about changing the startup disk?

    In the System Preferences, Startup you can select an alternative volume if it has a valid OSX system and when you reboot it will boot from this volume.

    Do you want an Applescript to change the Startup Disk to an alternative Volume?

    You'll need to use a Shell script as this is pretty core functionality in OSX.

    Assuming your alternative Volume is ready you want to run a command like

    sudo systemsetup -setstartupdisk /Volumes/< name of drive you wish to boot to >/System/Library/CoreServices

    This will prompt for root/admin password
    Then when you reboot the selected Volume will be the boot system.

    For more info and options .. in Terminal type

    man systemsetup
    man bless


    Author Comment

    I ran following script and get "Set Startup Disk to Path : /Volumes/Restore/System/Library/CoreServices" message from Terminal.

    tell application "Terminal"
          do script "sudo systemsetup -setstartupdisk /Volumes/Restore/System/Library/CoreServices"
    end tell

    How can I set Startup disk path?
    LVL 1

    Accepted Solution

    this will do it.  Just replace the name of the volume with the one you want;
    do shell script ¬
     "bless -mount \"/Volumes/Name of the drive\" -setBoot" ¬
     with administrator privileges
    do shell script "shutdown -r now" with administrator privileges

    Open in new window


    Author Closing Comment

    You are the Champ!

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Join & Write a Comment

    How to remove superseded packages in windows w60 or w61 installation media (.wim) or online system to prevent unnecessary space. w60 means Windows Vista or Windows Server 2008. w61 means Windows 7 or Windows Server 2008 R2. There are various …
    Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
    The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
    The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

    746 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now