Reboot Into BootCamp – Script, AppleScript, App 10


Reboot Into BootCamp – Script, AppleScript, App


I use Windows semi-regularly to play PC games, when booting into Windows with Boot Camp, I normally have to restart as normal, wait for the main screen to pop up, press Option, restart my Mac again because I forgot to press option, select my Windows hard drive and boot up as normal. This takes far too long and in the boot time I would rather get a drink than wait to select the correct drive. So I went on a quest last night to find a simple one click solution to reboot, automatically into Windows. I wanted a solution where I click an icon and my Mac restarts, avoiding an option to enter my password. As you will find out this is a lot harder than you would think. There is three solutions that do work each with varying results. These are a Terminal command /script. An AppleScript and an Application someone has designed.

Terminal Script

When doing anything like this I automatically turn to a Terminal script. Most of the time there is a solution. There is actually a solution which does work, however I deem it to be a bit “violent” as it kills everything immediately and then restarts. This is OK, however any unsaved files will not prompt the save dialogue box. The script itself is as follows.

/usr/sbin/bless --device /dev/disk0s3 --setBoot --legacy --nextonly | sudo shutdown -r now

The thing to note is that /dev/disk0s3 is the Boot Camp disk. You can find out which disk it is in Disk Utility, you may need to change disk0s3 if you have more than one partition or drive.

The previous script did work, a warning does come up every so often in Terminal. Due to the way your Mac system is built you cannot skip the add password bit. This includes setting the script as root user. I could get round this by adding my password into the script as a variable but this would open a security hole that I didn’t want.

As a result the Terminal script did what I want, however it was a little bit violent, as mentioned, and I would need to add my password, so I turned to AppleScript.

AppleScript – Background

I find AppleScripts tend to follow Terminal scripts in there layout and function. As a result it wasn’t too hard in finding and working out a simple one line script that I could use. In AppleScript typing the following and compiling it would allow you to restart into BootCamp.

do shell script "bless -mount /Volumes/WINDOWS/ -legacy -setBoot -nextonly; shutdown -r now" with administrator privileges

This will prompt your for your password and restart in the same manner as the Terminal script (since it is running a Terminal script). AppleScript has an option where you can add a password for it to run with. Normally you would be opening up a hole in your security, but if you save the resulting Application as “Run-only” the contents is scrambled, as a result it is a lot harder to get your password. This can’t be done with a Terminal script.

do shell script "bless -mount /Volumes/BOOTCAMP/ -legacy -setBoot -nextonly" password "xxxxxxx" with administrator privileges
do shell script "shutdown -r now" with administrator privileges

This still restarts your computer by killing everything, it doesn’t do a nice restarts by closing Applications, this is where the power of AppleScript comes in.

AppleScript – Working App

Having learn’t (for about two hours) in getting something to work I ended up if a working AppleScript that did what I wanted. It would restart my computer into Boot Camp, have a nice shutdown by closing apps (not violently killing them) and not need my password but still being secure. To do this open AppleScript Editor and paste the following.

do shell script "bless -mount /Volumes/BOOTCAMP/ -legacy -setBoot -nextonly" password "xxxxxxx" with administrator privileges
tell application "Finder" to restart

Edit both the disk which Windows is stored on and your password. Then go to File > Save As, name the application and select “Application” as the file format and select “Run Only” from the check boxes. Then save and test out your file. It should restart into window, while shutting your computer down in a timely and safe manner.

Prefect, a script to do exactly what I want in a safe any easy way. The icon was produced by pasting an image into the icon in the Get Info pane of the finished AppleScript Application.

reboot into windows applescriptApplication

To finish off this post I searched for an application which does the same thing, if your note a code wizz but want something useful. I searched around and found BootChamp, it will restart you Mac into Windows but you can quickly access this from the menu bar. It does need your password which is semi-annoying but it is still a good little app.


To finish off I have shown your three ways in which your can restart you Mac into Windows. The first is a Terminal script which is violent but very quick. An AppleScript which does the same job but allows your to skip using your password and an Application which does the same job.

If you have any comments please leave one below.

If you want to keep up with the latests post from Mac Tricks And Tips I recommend you subscribe to the RSS Feed.

Where To Next?

  • Subscribe To Mac Tricks And Tips