Shortcut to boot into different startup disk

bootstartup

I often boot into an external startup disk. In order to do this, I need to access the Startup Manager by holding alt/option while rebooting and then selecting the disk I want to boot up into.

Since I do this so often, I wanted a more streamlined way to boot into the external drive. Is there a way to boot up into a specific external drive, without having to use the Startup Manager?

I could change the startup disk to something else, but the problem is that this is common to both disks – i.e. while I am starting up from Macintosh HD 1 and select Macintosh HD 2, when I boot up in Macintosh HD 2 the startup disk will also be Macintosh Disk 2. have to change this every single time, so I'm looking for something more like a shortcut to boot into the startup disk Macintosh HD x.

Best Answer

Boot to Macintosh HD 1, launch Keychain Access and create a new generic password item with the name boot_key in your login keychain with the following attributes (replace "klanomath" with your admin user name and "Passw0rd" with your admin user's password):

enter image description here enter image description here

The password is self-evidently also klanomath's login password. security is always allowed to use the key! The exec security can be found in /usr/bin/.

Then open Automator and create a new service.

  • Set "Service receives" to "no input" in "any application"
  • Add the action "Run AppleScript" and paste the following code (replace klanomath with your admin's user name below):

    on run {input, parameters}
    
        do shell script "security 2>&1 >/dev/null find-generic-password -gl \"boot_key\" | awk '{print $2}'"
        set myPass to (text 2 thru -2 of result) as text
    
        do shell script "systemsetup -setstartupdisk \"/Volumes/Macintosh HD 2/System/Library/CoreServices\"" user name "klanomath" password myPass with administrator privileges
    
        tell application "System Events"
            set appList to the name of every process whose background only is false
        end tell
        repeat with theApp in appList
            try
                tell application theApp to quit
            end try
        end repeat
    
        do shell script "shutdown -r now" user name "klanomath" password myPass with administrator privileges
    
    
        return input
    end run
    

    Screenshot of Automator:

    enter image description here

    The middle part of the AppleScript (tell application "System Events"... tries to quit all open apps gracefully.

  • Compile and save the service (in my example the name is change_bootdisk)
  • The service will be saved to ~/Library/Services
  • Open System Preferences > Keyboard > Shortcuts > Services, choose the service name and apply a shortcut (in my example altcmdB).

    enter image description here


On your other boot volume you have to perform the same steps but replace the boot drive in the second do shell script:

do shell script "systemsetup -setstartupdisk \"/Volumes/Macintosh HD 1/System/Library/CoreServices\"" user name "klanomath" password myPass with administrator privileges