Native EFI Windows 7 Installation on Macs with OSX guide

Native EFI Windows 7 installation on Macs

For average users you won't have problem install Windows 7 with help of bootcamp assuming that Apple provides the Windows 7 drivers for your mac. What if you want to install multiple OS X and plus a Ubuntu alongside Windows on your Mac?

You will find out that the hybird GPT won't work and Windows 7 installation will complain "The selected disk is of the GPT partition style" in which case you need to install Windows 7 via efi not the legacy CSM. On a PC, you can set your BIOS to UEFI boot and install Windows 7 without problem. However, on a Mac, this could be head banging and miserable situation.

It's not Apple or Microsoft's fault, but rather different implementation history.

To install Windows 7 on GUID partitioned HDD (GPT), you will need to boot from EFI mode not BIOS mode, but in EFI mode, there is no direct VGA support for Windows 7 on Macs, unless you change the VGA and bridge controller register from EFI shell before loading Windows.

This is going to be Autounattended installation and wipe up everything on the hard drive, so please backup your data before proceeding.

So, let's get started:

1. Install rEFInd and download Intel's Open Source UEFI shell - Shell_Full.efi
    Change the VGA and Bridge controller register in efi shell:

mm 0010003E -PCI 8
mm 02000004 -PCI 7


Please refer to Windows 10 on Old Macs for the details.

2. Create Windows 7 UEFI USB installation media with rufus, don't forget to choose "UEFI" not "CSM"
    We won't use Windows 7 DVD here as we will need to add Autounattended.xml file into the USB later
3. Create Autounattended.xml file
    Just get a sample file from Microsoft

Remember to copy 64-bit UEFI not the 64-bit BIOS and also change the EFI partition from 100MB to 300MB, otherwise, later when you try to install OS X and try to prepare Volume for OS, Disk Utility will complain "Volume erase failed: Media kit reports not enough space on this device for requested operation".

4. Insert Autounattend.xml into to USB installation

The Autounattended.xml should be copied into the root directory of the WIM file, not the root of the USB. We can use Windows DISM or use wimlib-imagex in Linux. Apparently, in Linux it's much quicker mount and unmount boot.wim.

wimlib-imagex mountrw /media/jtcm/GSP1RMCPRXF/sources/boot.wim 2  ~/mnt-points/wim/
cp Autounattended.xml ~/mnt-points/wim
wimlib-imagex unmount ~/mnt-points/tmp/ --commit

5. Boot from UEFI USB and you won't see anything on the screen, wait until your Mac reboot twice and leave it for another 10 minutes or anytime you like

6. From the Autounattended.xml copied from Microsoft sample, you will need to put your User name in, and some defaults settings blindly. So, type in User name and press enter 5 times slowly. You might want to try on a PC/VM to get an idea how it would look like.

7. Now Windows 7 should boot into Desktop if nothing goes wrong, but you still can't see anything on the screen. Use keyboard to do the following blindly again:

Press Command key(Windows key) -> Type cmd -> Press Ctrl+Shift+Enter↵ -> Press Left key -> Press Enter
Now you are in elevated command line and carefully type the following command to switch off Windows firewall and enable Administrator and enable remote registry so we can turn on remotely login and install the video driver:

netsh advfirewall set allprofiles state off
net user administrator /active:yes
net user administrator password
net start remoteregistry
sc config remoteregistry start= auto

From a working Windows, open regedit.exe and Connect Network Registry,
Go to HKEY_LOCAL_MACHINE \ SYSTEM \ CurrentControlSet \ Control \ Terminal Server
Change value 1 to 0 on fDenyTSConnections

Now, remote rdp and install Nvida driver (or ATI) from bootcamp 4/5 (anything compatible to your Mac)

Restart, tada you see Windows 7 now.

8. Install OS X
Shrink Windows partition and create a new partition and format as NTFS, just prepare this for OS X DiskUtility, I've tried to create and format new partition in OS X install terminal, but Yosemite& El Capitan won't allow you to install on that Volume for unknown reason, I must missed something.

gpt -r show disk0
gpt add -s 123456789 -b 123456789 -i 4 disk0
newfs_hfs -v "OSX" -J /dev/rdisk0s4

Go to Disk Utility and erased the new partition again, but this wont' work.

However, with the NTFS formatted partition, you can easily erase and install OS X on it.