DEV Community

Josh Clements
Josh Clements

Posted on

How to use macOS Boot Camp on a USB stick

Originally posted on 22 July 2016

My equipment:

  1. 13" MacBook Pro, Early-2015.
  2. Windows 10 EDU in VMWare Fusion 8.
  3. 128GB SanDisk UltraFit USB 3.0 (ultimate destination for Boot Camp).
  4. Seagate 750GB SSD/HDD Hybrid in a USB enclosure.

What you'll need:

  1. Windows ISO (I'm using Windows 10, but should also work with 7, 8, or 8.1). You can also use a Windows installation disc.
  2. gimagex.
  3. Existing Windows 7, 8, 8.1, or 10 64-bit installation, physical or virtual machine.
  4. A USB hard drive and a USB stick (yes, both).
  5. Your Mac, of course.

Summary of steps:

  1. Partition the USB hard drive.
  2. Write the install.wim image to the USB hard drive.
  3. Make the USB hard drive bootable.
  4. Clone the USB hard drive contents to the USB stick using dd.

1. Partition the USB hard drive

  • Insert the USB hard drive into the Windows machine and launch Command Prompt (Admin).
  • Type diskpart to launch the DISKPART utility.
  • Type list disk to see the list of attached disks. Note the disk number associated with your USB hard drive. I'll refer to it as X.
  • Type select disk X, then type list disk and confirm an asterisk next to the proper disk.

    WARNING The following step will wipe all data from the USB hard drive:

  • Type clean.

  • Type convert mbr to create a Master Boot Record (MBR) partiton table. I did not get a GPT disk to work with the USB stick.

  • To create a 200MB EFI partition, type make partition primary size=200.

  • Format the EFI partition by typing format fs=FAT32 label=EFI quick.

  • Assign the partition a drive letter: assign.

  • Make the partition bootable by typing active.

  • Create the partition for the Windows installation: create partition primary size=120000.

If you're chops are strong, you can size the your partitions exactly to match the target USB stick size. The cloning process is lengthy and I hate waiting again if I screw it up, so I chose to keep the partitions a little smaller. I'm using a 128GB USB stick, but there's never the "full" amount available, so I sized the partition to 120GB, or 120000MB.

I also tried using a 64GB partition so I could put a Linux distro on the USB stick. Because it's a USB stick and has to be an MBR, I did not successfully add a Linux distro to the stick. Point is, it doesn't pay to save space; just make the main Windows partition the full size of your USB stick. It's also worth noting that you won't be able to change the partition scheme after you've cloned it to the USB stick in later steps.

  • Format the main partition: format fs=ntfs label=Windows quick.
  • Assign the partition a drive letter: assign.
  • You should now have two partitions with drive letters assigned.

2. Write the Windows image to the USB hard drive

  • Download your chosen version of Windows to the Windows machine you'll be working from.
  • Download gimagex. There are also official Windows command line tools, but this one is a GUI.
  • Double-click the ISO to mount it. Windows will assign a drive letter to it.
  • Open gimagex and select the Apply tab.
  • In the Source field, select the mounted ISO and navigate to sources\install.wim.
  • In the Destination field, select the Windows partition on the USB hard drive.
  • Press the Select button directly across from the Image field to select your desired image.

Depending on your installation medium, you may have multiple versions of Windows you can install: Home, Professional, Enterprise, or EDU in 32 or 64-bit flavors. Make sure you choose a 64-bit version for your Mac.

  • Press the Apply button.

Depending on your machine, the apply process may take 15 minutes to a couple hours. Mine typically took about 20-30 mins.

  • While you're waiting for the apply process to complete, download the Boot Camp Windows Support software by opening Boot Camp Assistant on your Mac and selecting Download Windows Support Software from the Action menu.

You can copy the support software to a separate USB stick (not the one you're using for Boot Camp) or you can copy the software over to the Windows machine and place it in your Public Downloads folder after the apply process is complete. If you're reading this tutorial, you're probably savvy enough to figure out how to do this.

3. Make the USB hard drive bootable

  • Once the image has been applied to the USB hard drive, launch Command Prompt (Admin).
  • Type X: where X is the drive where the Windows image was just applied.
  • Type cd Windows\system32.
  • Type bcdboot.exe X:\Windows /s Y: /f ALL where:
    • X is the drive letter for the Windows partition on the USB hard drive and;
    • Y: is the drive letter for the EFI partition on the USB hard drive.

I had some issues with bcdboot making the EFI folders on the Windows partition instead of the EFI partition. Once bcdboot has done its thing, you can copy the EFI folder from the Windows partition to the EFI partition. You may not be able to delete the EFI folder from the Windows partition because of the permissions assigned to it. I haven't had any issues with it remaining there.

At this point, you have an external USB hard drive from which you could run Windows. I recommend you test it to make sure it works up to this point by doing the following:

  • Copy the Windows Support Software into the Public Downloads folder (or anywhere else it's accessible by all users) on the Windows partition of the USB hard drive.
  • Eject the drive from your Windows machine and plug it in to your Mac.
  • Restart your Mac while holding the Option key. Release it once you see Macintosh HD and EFI Boot.
  • Select EFI Boot.
  • Allow Windows to setup. When it restarts, make sure you hold the Option key so you can select EFI Boot.
  • Once Windows finishes its initial setup, install the Windows Support Software (optional).
  • Restart to make sure everything is working.

4. Clone the USB hard drive contents to the USB stick using dd

  • Restart your Mac into OS X/macOS.
  • Insert the USB stick. Both the USB hard drive and stick should be plugged in to your Mac.
  • Open Terminal. Type diskutil list.
  • Make note of the disk numbers for the USB hard drive and the USB stick. I will refer to the hard drive as disk2 and the stick as disk3.
  • Unmount both disks by typing: sudo diskutil unmountDisk /dev/disk2 and sudo diskutil unmountDisk /dev/disk3.
  • Begin the cloning process by typing: sudo dd if=/dev/rdisk2 of=/dev/rdisk3 bs=1m count=121000.

Explanation: dd typically uses 512-byte blocks. Using bs=1m changes it to one megabyte. count= tells dd how many blocks to write. For my 128GB drive, I made a 200MB EFI partition and a 120000MB Windows partition, so I've told dd to write 121,000 blocks. This ensures it captures both the EFI and Windows partitions, plus some extra for the space taken up by the partition tables and offsets. Adjust as your needs dictate.

This can take a significant amount of time, depending on how many blocks you are writing. It took about 2 hours when I was experimenting with the 64GB partition; for the 120GB, I just set it and went to the beach.

Once dd has completed, eject the USB hard drive and restart your Mac, holding the Option key and selecting EFI Boot.

Conclusion

The USB 3.0 stick isn't the fastest way to run Windows on your Mac. If you open up Performance Monitor, you'll see your main Windows partition maxed out at 100% rather frequently. But if you're strapped for space on your Mac, this will get you by.

Helpful Resources

Nowadays, no one is a self-made genius. I found these articles particularly helpful when stumbling through this procedure:

Top comments (6)

Collapse
 
tobiassn profile image
Tobias SN

Isn’t it easier just to use Windows To Go?

Collapse
 
fundatillus profile image
Josh Clements

Absolutely! Unfortunately, WTG requires the Enterprise edition of Windows and Microsoft-certified compatible USB sticks to work. This tutorial is one possible workaround to these limitations.

Collapse
 
tobiassn profile image
Tobias SN

There are also programs that allow one to do it on the Home edition.

Thread Thread
 
fundatillus profile image
Josh Clements

Cool! I'll admit that I didn't research other solutions... can you post a link here so others can find?

Thread Thread
 
tobiassn profile image
Tobias SN
Thread Thread
 
fundatillus profile image
Josh Clements

Great! Thanks for your contribution!