2

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.

3
  • 2
    Related: Changing a startup disk using AppleScript. Instead of using the bless command use systemsetup (e.g sudo systemsetup -setstartupdisk /Volumes/Macintosh\ HD\ 2 booted to Macintosh HD 1 or sudo systemsetup -setstartupdisk /Volumes/Macintosh\ HD\ 1 booted to Macintosh HD 2). Remove the dialog part from the AS (the first seven lines), save it as service and apply a short cut.
    – klanomath
    Commented Feb 27, 2018 at 21:53
  • This is pretty much the answer I was looking for, so feel free to post it as one
    – Oion Akif
    Commented Mar 1, 2018 at 13:14
  • I will write an answer (adapted to 10.11 and newer - using bless is not recommended then; the OP of the linked question implied it though) soon...
    – klanomath
    Commented Mar 1, 2018 at 13:17

1 Answer 1

1

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
1
  • Really cool answer. Still useful now
    – Oion Akif
    Commented Jan 22, 2021 at 19:42

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .