How to Change the Mac Startup Disk From the Command Line

By Nick Peers

Although you can change the startup disk from the System Preferences window in Mac OS X 10.9 Mavericks, there are times when you may need to change it from the Terminal. For example, you can incorporate this function into a more complex UNIX shell script that is configured to maintain backups of your disks by imaging them. The Terminal gives you access to the UNIX system, so it can be a dangerous tool if you don't know what you're doing.

Use the Bless Command

Step 1

Click the magnifying glass icon at the top of the Mac screen to display the Spotlight dialog box, type "Terminal" and then click "Terminal" in the list of results to launch the Terminal utility.

Step 2

Type "sudo bless -mount /Volumes/Startup_Disk_Name -setBoot" without the quotation marks into the Terminal window. The Bless command changes the startup disk. Replace "Startup_Disk_Name" with the correct name of the disk you want to boot from. If the name contains spaces, enclose the entire path in quotation marks. For example, if your startup disk is labeled "My Mac," type the following command: sudo bless -mount "/Volumes/My Mac" -setBoot.

Step 3

Press "Enter" to run the command and change the startup disk. Note that your Mac boots from the new disk after you restart it. To restart the Mac from the command line immediately, run the following command: sudo shutdown -r now. Don't forget to save your work before you issue the command.

Tips & Warnings

  • To get more information on the Bless command, type "man bless" without the quotes into the Terminal and press "Enter."
  • A simple bash shell script that changes the startup disk and then restarts the Mac looks like this:
  • #!/bin/bash
  • bless -mount /Volumes/Startup_Disk_Name -setBoot
  • shutdown -r now
  • To run the shell at a specified time, create a Cron job.
  • Don't forget the "sudo" part of the command to run it as a superuser from the Terminal. Using "sudo" in a bash shells script is not necessary, especially if you run the script as a superuser.
  • You can change the startup disk while the Mac is booting. Just hold the "Option" key after you turn on or restart your Mac to display the Startup Manager. Use the arrow keys to select the drive you want to boot from and then press "Enter" to use it.
  • To change the startup volume from the System Preferences menu, click "Apple," select "System Preferences" and then click "Startup Disk" to display the Startup Disk window. Enter your username and password if prompted, select the disk you want to boot from and then click "Restart."
  • Don't run commands in the Terminal unless you know what you're doing. Because the Terminal allows unrestricted access to the UNIX system, you can cause serious damage to the operating system if you run a wrong command. Even a typo can cause irreparable damage.
  • If you use the Startup Disk to change the startup drive, make sure you don't accidentally select a network install image. The image is designed to reinstall the system software, so you may lose everything on the hard drive. You can easily recognize a network install image because its icon has a green arrow that points downwards.