?
Solved

Apple script: How to boot to other volume

Posted on 2009-02-20
5
Medium Priority
?
404 Views
Last Modified: 2012-05-06
I need snippet to boot to other volume such as 'TEST'
0
Comment
Question by:myang999
  • 3
5 Comments
 

Author Comment

by:myang999
ID: 23697905
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'.
0
 
LVL 41

Expert Comment

by:Eoin OSullivan
ID: 23699471
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


0
 

Author Comment

by:myang999
ID: 23702485
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?
0
 
LVL 1

Accepted Solution

by:
ogcyborg earned 2000 total points
ID: 23718694
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

0
 

Author Closing Comment

by:myang999
ID: 31549455
You are the Champ!
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
In threads here at EE, each comment has a unique Identifier (ID). It is easy to get the full path for an ID via the right-click context menu. However, we often want to post a short link within a thread rather than the full link. This article shows a…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.
Suggested Courses
Course of the Month13 days, 13 hours left to enroll

807 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