3

Is there a way to create a shortcut (that I can place on the Dock, perhaps) that will restart OS X with the Bootcamp partition?

This would be similar to going into System Preferences/Startup Disk and then choosing the partition and hitting Restart. I don't want to use Automator to do this unless I can do it without popping up a bunch of windows.

The funny thing is that Windows has a tray shortcut for this, but I've found nothing equivalent on the OS X side.

Thanks!

Chealion
  • 5,713
  • 27
  • 29
Corey Ross
  • 133
  • 1
  • 4

2 Answers2

3

There are a couple options:

One - when you restart you can hold the 'Option' key down and then choose Boot Camp - however this is a temporary selection so if you restart again it will start back up in OS X (or whatever the selected startup disk actually is).

Two - You'll need to find out the disk ID by running df -k - more than likely it is /dev/disk1s3 if you have partitioned your hard drive but you'll want to double check. So change the '#'s in the following command to the appropriate numbers:

sudo umount /Volumes/NAME_OF_YOUR_WINDOWS_DRIVE
sudo bless -device /dev/disk#s# --legacy --setBoot
#You could use -folder but this assumes the drive is always mounted and writeable
#Then a slightly cleaner restart than shutdown -r (which sends a kill message)
osascript -e 'delay 1
 tell application "System Events" to restart' &

You can save that as part of a shell script or use Platypus to create an actual runnable application that will run the shell script for you.

Additionally there are other options listed on MacOSXHints

Chealion
  • 5,713
  • 27
  • 29
0

I feel that the easiest way to do this is by opening up Script Editor... pasting the following in it. Which is a script that will restart the computer into windows. Make sure you change the password to yours though. all you have to do is double click it and it will automatically do everything for you. Leave everything like it is except for the line that says set adminpass to "****" - change the asterisks ( * ) to your password.

set adminpass to "*****"

tell application "Finder" set iconPath to (get name of startup disk) & ":Applications:Utilities:Boot Camp Assistant.app:Contents:Resources:DA.icns" as alias end tell

set askRestart to display dialog "Restart in Windows?" buttons {"Cancel", "Restart"} default button 1 with icon iconPath set doRestart to button returned of askRestart

if doRestart is equal to "Cancel" then quit end if

if doRestart is equal to "Restart" then do shell script "bless -mount /Volumes/BOOTCAMP/ -legacy -setBoot -nextonly; shutdown -r now" password adminpass with administrator privileges end if


after this, go to file, export- name the file whatever you want- ex. BootToWindows.scpt. In the left, click desktop, so it saves it there. at the bottom, change the file format to Application so that it runs when clicked instead of opening. if you ever need to edit it, you can right click the application, click show package contents, navigate to Contents, Resources, Scripts, and double click main.scpt, and it will open it in the scripts editor for editing.

Deer Hunter
  • 1,070
  • 7
  • 17
  • 25