Archive for the ‘Dual Boot’ Category

WinRestart: Applescript Mini-App for Automatically Restarting Boot Camp in the Windows/Linux Partition

Thursday, March 20th, 2008

If you’re like me, you use Boot Camp to run both Windows/Linux and OS X on your Intel Mac. It’s truly a great setup, especially if you use a one-extra-partition setup (I use MacDrive on the Windows side) to share the same documents between all OS’s, and Thunderbird and Firefox sharing the same profiles to get to all your email, bookmarks and preferences from any OS.

The only downside to this setup is having to reboot every time I switch OS’s. Boot Camp only allows one partition to be the default startup disk. I keep my default set to OSX, since that’s what I use most. But if I want to reboot in Windows or Linux, I have to sit and wait while I hold down ‘alt’ and the Boot Camp bootloader comes up. I would rather spend this time staring out the window, or getting up for coffee.

That’s why WinRestart is awesome.

WinRestart is a [painfully] simple two lines of Applescript (thanks to Taylor for the code) that passes a shell script to the Terminal, using the bless command. This sets your Windows/Linux partition to be the boot disk on the next restart only. WinRestart is saved as an application, which means you can keep it in your Dock. Just click to launch, and you’re on your way to automatic restart heaven!

After downloading and extracting WinRestart, open it up in the Script Editor (Applications -> AppleScript -> Script and change the name of the boot volume to your alternate partition. For example, if your Linux partition is named ‘linuxpartition,’ you would change the default Untitled:

do shell script “bless -mount /Volumes/Untitled/… privileges

to ‘linuxpartition’ (no quotes, though):

do shell script “bless -mount /Volumes/linuxpartition/… privileges

Set the name of your Alternate Partition

UPDATE: Andy writes with this tip about using WinRestart with an NTFS partition:

I just wanted to thank you for your WinRestart post on rainbowlazer. It was pretty much exactly the information I wanted — however, using a NTFS partition for boot camp did cause some problems with using bless.

Bless seems to require statfs, when you use it with the –mount option, which apparently isn’t supported with MacFuse/NTFS-3G. Instead [of bless -mount /Volumes/Untitled/ -legacy -setBoot -nextonly], the following bless command worked great for me:

bless –device /dev/disk0s3 –legacy –setBoot –nextonly

Thanks for the input, Andy!

UPDATE: Tim writes with this tip about adapting WinRestart to work with System Events to prompt saving of open documents before restart:

Thanks for developing the WinRestart application. I wanted to comment that I have used it a lot and have found it really helpful. I made a version of the script that might suit most users a little better though, maybe you would like to post it as an alternative.

do shell script “bless -mount /Volumes/Your_Volume_Here/ -legacy -setBoot -nextonly” password “Your_User_Password_Here” with administrator privileges
tell application “System Events”
end tell

It doesn’t ask for a password and lets you save unsaved documents/close programs.

For users of this, I also recommend turning off the startup screen in the WinStart File menu.

Many Thanks Again,


Thanks for the tip, Tim!
The addition of your password in plaintext is a little iffy in my opinion, but if you’re not worried about it then it’s a good time-saver.