Reboot Mac OS 10.* to BOOTCAMP from a desktop icon

Problem: I want a quick way to restart my macbook and boot to the Bootcamp partition with one or two clicks, for the next boot only. The two existing ways are:

  • Restart OS X then hold the option key after the startup sound to bring up the boot options. This can be a pain if you miss the sound, or if you want to initiate a reboot and then bog off and make a cup of tea.
  • Go to System Preferences > Startup Disk > select the Bootcamp partition > Click Restart. This sets the default boot disk, so needs to be un-set next time you want to boot back into OS X.

Solution: Mac OS can be rebooted with the shutdown command, and boot partition can be set with the bless command. like so:

sudo bless -mount "/Volumes/BOOTCAMP" -legacy -setBoot -nextonly; sudo shutdown -r now

(Assuming your bootcamp partition exists at /Volumes/BOOTCAMP)

As is probably obvious from the command, the -nextonly part means that the boot partition is being changed for the next boot only. The -r part of the shutdown command means it will reboot again, and the ‘now’ command means just that.. do it right NOW.

Running from an icon: The command above can be run with a small script like so:

  • Run AppleScript Editor.
  • type the following into the editor window:
tell application "Terminal"
	do script "sudo bless -mount "/Volumes/BOOTCAMP" -legacy -setBoot -nextonly;sudo shutdown -r now"
end tell
  • Save this script as an ‘Application’ to your desktop and give it an obvious name like ‘Reboot to Windows’.
  • Double-click the icon and Terminal should run, asking you for a password. Much quicker 🙂 (if you want to cancel the process, use CTRL+C to exit the script as you usually would)
Any comments or improvements? Please leave them below!

Leave a Reply

Your email address will not be published.