How to set the Boot Volume from CLI in OSX

I’ve run into this issue a number of times a year, including today again, and I have to dig up the email I sent to myself last year with the command line in it. If, like us, you have a bunch of headless Xserves and you’re trying to (re)install OSX on them you might have run into this. How the heck do you change the boot volume to the CD/DVD in the drive when you have no keyboard/mouse access or remote desktop? Well turns out it’s quite simple (as usual). Just issue the command below from a ssh session (make sure the install CD/DVD is in the drive first):

  • Run diskutil list to make note of the CD drives partition number (usually /dev/disk1s2 if the system has one Hard drive only).
  • Run sudo bless –device /dev/disk1s2 –setBoot (You can also add –nextonly if you want to do this for just one boot cycle).
  • Run sudo reboot

You can also set a netboot server as your boot source:

  • Run sudo bless –netboot –server bsdp://255.255.255.255 (for subnet broadcast or specific IP address for specific netboot server).
  • Run sudo reboot

Bless the bless guy for blessing us with the bless tool :-)

3 thoughts on “How to set the Boot Volume from CLI in OSX

  • Rick James

    Yo I just started my blog on INVENTING and noticed your blog is similar. If you could help me out with some of this basic stuff and check out my blog. I know Im a noob..lol

Leave a Reply