[GUIDE] keeping iGPU activated when booting into Windows using apple_set_os.efi
Some of the information below is outdated as macOS 10.15 was released. For Macs that have been updated to macOS 10.15 or later, please use this version:
@aa15032261 pointed out that it does not always load successfully with T2 chip equipped Macs.
To remedy this issue, I created a similar workaround with the help of EFI Shell, using 0xbb's apple_set_os.efi
echo -off fs0: stall 1000000 \EFI\Boot\apple_set_os.efi if not %lasterror% == 0 then reset -w endif \EFI\Microsoft\Boot\bootmgfw.efi
It repeatedly restarts the system until the apple_set_os.efi loads successfully.
If you're willing to combine iGPU enabling and dGPU disabling, please read through my 2015 15" MacBook Pro Master Thread. It also explains how to configure startup.nsh.
nando4>> Refind 0.11.x bootmanager has been updated. When the spoof_osx_version token is set in the refind.conf, it will work like @goalque's apple_set_os.efi documented below, effectively providing a user-friendly replacement for it.
By default, Apple’s firmware switches off the iGPU when there is eGPU or dGPU present and you’re booting into another OS than macOS. This happens especially with multi-slot enclosures such as Sonnet Echo Express III-D and Netstor NA211TB. Depending on the eGPU, iGPU may stay enabled with a single-slot enclosure but it’s not absolutely certain.
It is desirable to activate the Mac's iGPU in Windows for two reasons:
- to overcome error 12 on your eGPU. Then a dGPU's PCIe x16 host bridge can be disabled to free up resources.
- to provide an eGPU accelerated internal LCD by AMD X-Connect or NVidia Optimus -> an active iGPU is required.
To enable the iGPU during a Windows bootup we use apple_set_os.efi to spoof a macOS boot as explained below.
- Windows 10* or 8.x UEFI installation
- A Macbook with UEFI 2.0 firmware. Known working systems being:
The following are likely not UEFI 2.0 compatible for apple_set_os.efi to work. See linked discussion with inconclusive results.
* Windows 10 version is important – I recommend 10.0.10586 (I am not sure about later builds). Older builds required also VGA enable bit of the parent PCIe bridge, but seems that newer versions ignore this setting.
USB stick creation procedure
1. Format an USB stick in Disk Utility (Choose Erase, Format: MS-DOS (FAT), Scheme: Master Boot Record)
2. Create a USB stick folder structure in Finder as follows: /EFI/Boot/bootx64.efi where bootx64.efi is the renamed apple_set_os.efi file downloaded below.
Windows Boot via USB stick instructions
If necessary, hot-plug the Thunderbolt cable at the stage of Windows flag or spinning circle for systems that refuse to POST with a Nvidia eGPU. "Refuses to POST" means that Apple's startup manager does not appear when holding down the Option key. This is often required on late-2013 15" GT750M and early-2015 13" MacBook Pros. "automate-eGPU.sh -a" mode helps but it's not persistent on the Windows side. Depending on the eGPU enclosure used it's also worth trying other TB ports too.[Late 2016 13" non-touch MBP] Connect the enclosure to the second TB3 port of the MBP and the USB-C-to-USB adapter to the first (port closest to the ESC key)
Performing the Windows boot
1. Open Startup Disk on macOS, choose BOOTCAMP partition. Shut down.
2. [GT750M/M370X/RPxxx 15" MBP only] Prior to booting into Windows with the eGPU plugged in, run 0xbb's integrated.bat as administrator. This sets the Apple gmux to wire the internal LCD to the iGPU when you reboot your system [into Windows].
3. Restart the Mac with the USB stick and eGPU plugged in to the correct TB port (will vary depending on the eGPU enclosure/Mac model).
4. Hold down Option key and you should see a new disk "EFI Boot".
5. Select "EFI Boot". This will boot into Windows, transparently via bootx64.efi (apple_set_os.efi) with your iGPU active.[2014+ MBP models] If you see error code 12 with Nvidia, disable the parent PCI Express Downstream Switch Port of the eGPU in Device Manager, and then enable it. No restart required. Older MBP's firmware don't support surprise removal/hot-plugging.
I found that as of macOS 10.12.4, Apple changed the APPLE_SET_OS_GUID protocol resulting in 0xbb’s original apple_set_os.efi no longer functioning. My fixed apple_set_os.efi skips the probematic set_os->version == 2 check. That's because set_os->version returns 3 with newer MBP firmwares. 0xbb's updated apple_set_os.efi V1 also implements the same code update.
FAQ: Can I avoid booting via a USB stick?
Yes. 0xbb's github homepage explains if you have rEFInd installed then it's just a matter of copying apple_set_os.efi to the EFI (ESP) partition to use it from there. @T2pierre incorporates this with a EFI shell script to provide an automated bootup here.
Usage:mkdir /boot/efi/EFI/custom cp apple_set_os.efi /boot/efi/EFI/custom
tested with iMac 5k late 2014, seems to work since I am able to detect and activate intel HD graphic cards in Win10
I have no eGPU to test if optimus would work for internal display use...but should be the case isn't it?
I think there is a very interesting use case in keeping the gorgeous iMac 5k internal display with eGPU
question: is is it possible to chain the EFI boot and bootcamp without changing the default boot disk?
Yes, it is possible. Either by loading \EFI\Microsoft\Boot\bootmgfw.efi
or \EFI\Boot\bootx64.efi as described here.
and combine commands into EFI script.
Here is a good starting point:
I have tried the EFI shell commands you recommended:
1) Download apple_set_os.efi
2) Download EFI Dev Kit: https://sourceforge.net/projects/efidevkit/files/latest/download
3) Format an USB stick in OS X Disk Utility (Choose Erase, Format: MS-DOS (FAT), Scheme: Master Boot Record)
4) Copy apple_set_os.efi to the root directory
5) Create a folder structure in Finder as follows: EFI/Boot/bootx64.efi
where bootx64.efi is the renamed Shell_Full.efi file from /Edk/Other/Maintained/Application/UefiShell/bin/x64/folder
6) Plug the USB stick into the USB-C to USB adapter, and connect it to your Mac (TB3 port closest to the esc key)
7) Connect the AMD eGPU
8) Turn on your Mac and hold the Option key down
9) Select "EFI Boot" with the enter key
10) Change file system to USB “fs2:” => on my configuration it is fs4:, working fine up to here
11) Type “apple_set_os.efi”
12) Change file system to Windows partition “fs0:” => I am stuck here, I have no access to the Windows partition, fs0 (apple EFI), fs1 (macintosh HD), fs2 (recovery disk), fs3 (unreadable, windows?), fs4 (usb).
13) cd EFI\Boot => BTW, there is no EFI folder on my BOOTCAMP partition
15) Wait for the “whoosh” sound!
If I make it work, I understand that I have then to create startup.nsh (in EFI/boot) with all the above refi shell commands that will be be automatically executed at boot time
Oddly enough, I haven't personally encountered this issue. Running late 2016 13" MBP with Touch Bar.
In fact, Windows seems to prefer using the Intel Iris 550 by default, and I need to use GeForce Experience or another Nvidia tool to whitelist apps for using my GTX 1060.
Is that normal? Is this issue supposed to affect everyone trying to run eGPUs on Macs, or does it only affect some of them?
- Is this any different from using rEFInd's (pretty new) spoof_osx_version feature (with the default 10.9 value)?
- On my early 2013 15" MBP, upon clicking "EFI Boot”, the MBP hangs. This with the pre-made binary downloaded from https://github.com/0xbb/apple_set_os.efi/releases (not built myself). The case is exactly the same as using rEFInd, copying the original .efi file in its /custom subdir and clicking its own icon there upon loading. Should I build the source code instead?
rEFInd’s implementation is exactly the same. The pre-made binary is ok.
Apple’s firmware favours dGPU in the pre-boot environment. In order to activate the iGPU, you must first configure the gmux device to use integrated mode with the gpu-switch. After that, you can run apple_set_os.efi. Did you try that in Windows 10 (Boot Camp)?
nando4>> Below is a concatenated discussion between goalque and Menneisyys on applying apple_set_os.efi to his GT650M 15" Macbook Pro. No definitive answer here other than a necessary UEFI Windows installation was difficult because, as goalque wrote:
Your MBP10,1 has an older firmware which doesn’t support Windows Boot Camp UEFI installation.
„In order to activate the iGPU, you must first configure the gmux device to use integrated mode with the gpu-switch. After that, you can run apple_set_os.efi. Did you try that in Windows 10 (Boot Camp)?”
No matter what I do, I get the
Error code was: 1
Error message was: Incorrect function.
error messages for both batch files in all these cases:
- no spoofing, normal mode, not installed HD 4000 drivers (that is, the default)
- spoofing, normal mode, installed HD 4000 drivers
- spoofing, Safe mode, installed HD 4000 drivers
- no spoofing, Safe mode, installed HD 4000 drivers
Also note that the Resources tab of the HD4000 shows „the device isn’t using any resources because it has a problem” in both Safe and normal mode (with spoofing and installed HD 4000 drivers).
Is it Windows 10 Boot Camp (UEFI)?
Run as administrator, right click the integrated.bat.
Yup, Bootcamp Win10 (tested via both rEFInd and the standard loader) and I use “run as admin” when right-clicking the batches. VC2013 x64+x86 runtime (as the DLL wasn’t found in the VC2010 one.).
Has anyone encountered these very error codes/messages?
Your screenshot shows that you are not running in the administrator mode. It should say: "Administrator: Command Prompt". As you now did, the must be some missing Win10 package. What's the Windows 10 build? Type "ver" in cmd.
Version: 10.0.14393 (fully updated). With no-admin execution, I get:
Error code was: 1300
Error message was: Not all privileges or groups referenced are assigned to the caller.
May be the problem caused by Windows 10 not being activated? I installed it about a week ago so it still hasn’t run out of 30 days. (I can reinstall & update it from Windows 7 so that it’s activated – I have legal licenses for Win7 but not directly for Win10.)
By the way, as some people reported success on booting into Windows with a, from the (connected) eGPU disconnected monitor, I re-tested the spoofed Bootcamp with my monitor disconnected.
1, cold boot (after powering up) right into Windows: boots; eGPU is invisible in Device Manager (HD4000 is visible, obviously - as we're spoofed)
2, warm reboot from Windows into Windows: freezes right at boot loader selector (rEFInd in this case)
3, warm reboot from MacOS into Windows, without running automate-eGPU-master: boots; eGPU is invisible in Device Manager (HD4000 is visible, obviously - as we're spoofed)
4, warm reboot from MacOS into Windows, with running automate-eGPU-master: freezes right at boot loader selector (rEFInd in this case)
That is, it behaved in exactly the same way as with a connected monitor.
I’ve removed Win10 + Bootcamp and installed a brand new copy of Windows 7. I’m having exactly the same symptomps:
- with the eGPU connected to the MBP, when booting after executing the script (without -a) or NOT from MacOS, freezes right on the boot loader selector screen, be it either rEFInd or the standard, stock (Alt) one. That is, the only case it boots in when I restart from MacOS without previously executing automate-eGPU.sh; that is, when the eGPU is completely hidden by design.
- this both with and without spoofing
- the iGPU (when spoofed, obviously) is listed with the same „the device isn’t using any resources because it has a problem” problem. Enabling it, of course, results in a black-screen boot. Also after auto-installing the driver it deemed the right.
- gpu-switch doesn’t at all work under Win7 – even after installing VC2013 x86 + 64, it complains about a missing entry point in the system KERNEL32.DLL.
- now that Win7 is activated, I could update (via the assistive tip) to Win10 Pro (this time, Activated). Exactly the same symptomps as before; that is, the lack of activation didn’t cause any additional problems.
gpu-switch requires UEFI, can you check your BIOS mode? Boot into Windows with eGPU disconnected when you try to run integrated.bat.
Thanks, I wouldn’t have thought my Windows 10 in Bootcamp still uses BIOS. Just examining the way of converting the entire stuff into UEFI.
Some updates on my struggles with my config: early 2013 15” MBP with HD4000 iGPU + 650M dGPU; Node via TB1->3 adapter; Sapphire Nitro 4Gbyte RX 480 card. Absolutely no problems with this eGPU under MacOS 10.12.3 - both for gaming and „serious” work like two-fold speedup of Capture One Pro image exporting. Windows, however, has been an absolutely no-go.
1, The post at https://egpu.io/forums/mac-setup/which-rx480-variant/#post-3886 state Sapphire cards just don’t work in BIOS environments - only in UEFI ones. This may be the reason for my system not booting in at all after executing the .sh script under MacOS and, then, restarting the device but freezing right on the boot loader selector screen, let it be the stock one or rEFInd.
2, My MBP being an early 2013 model, „Boot Camp Assistant” doesn’t use the UEFI not even when directly creating a Boot Camp partition with a Windows 10 (that is, unlike with Windows 7, fully UEFI-compatible) installer. I’ve tested this with two different x64 builds - the currently available-for-download one and an old (2015) 10.0.10586.
3, speaking of 10.0.10586, which is also recommended by goalque ( https://egpu.io/forums/mac-setup/macbook-pro-2014-15-gt750m-not-detecting-akitio-node-in-windows-10/#post-2671 ), it can’t boot with the card earlier made visible in MacOS either. That is, it behaves in exactly the same way as the current build.
That is, currently, it seems the only way I should go is manually converting the Hybrid MBR booting to UEFI booting. Here’s some explanation on what it’s all about: https://www.lai.nl/en/boot-camp-with-uefi-in-depth-and-deploystudio-can-do-that/ . If anyone knows a decent tutorial on how this is done (the one at https://www.reddit.com/r/mac/comments/3dlu2g/convert_a_bootcamp_bios_windows_installation_to/ has proved to be useless in my case - the step „create partition msr size=128” couldn’t be executed.)
Update (the next morning):
It seems it’s not easy to install any kind of Windows in UEFI mode on Macs with pre-2.0 EFI support. (Don’t be misled by Apple’s EFI updates’ version numbers, if existing - they do not have anything to do with the supported EFI versions. You can easily get the supported EFI version using eEFInd’s Info icon; it’ll be 1.1 for older models, incl. the early 2013 MBP.)
For example, I’ve closely followed the tutorial at http://fgimian.github.io/blog/2016/03/12/installing-windows-10-on-a-mac-without-bootcamp/ (an otherwise EXCELLENT tutorial!) to reinstall 10.0.10586 directly (without upgrading from an older Windows version). The result? A BIOS install, just like before - and not a UEFI one.
This all means you should NOT purchase graphic cards that are proved to be EFI-only ones; for example, the Sapphire RX 480 models, if you only have an MBP with non-current (1.1-only) EFI support. (See my link above.) Without excessive hacking (involving the complete reinstall of even the MacOS partition), it’s just not possible to install Windows in UEFI mode, which also means you won’t ever be able to make your Sapphire work under any kind of Windows. Not even Windows 8+, which has fixed one of the major problems with Win7 x64 with the graphics. (See Brendon’s post, August 3, 2013 at 6:47 am, starting with „I’ve found some interesting reading for those wanting to know why it is so difficult/impossible to get Windows 7 working in (u)efi mode on macs as opposed to Windows 8 – Windows 7 is not fully uefi compliant.” in the comment section of another tutorial / post worth checking out, https://darobins.wordpress.com/2009/10/04/native-uefi-windows-7-boot-on-mac-mini/ )
Another thread worth checking out: https://discussions.apple.com/thread/2767378?start=0&tstart=0 ; the two most important comments summarizing the info in it:
„rEFIt reports the following for a Macbook Pro 8,2. very disappointing. I could f'n care less about BIOS emulation or Windows. Could we please joint the modern era Apple? This EFI version is ancient and non-standard.
EFI Revision 1.10
Platform: x86_64 (64 bit)
Firmware: Apple 1.10
Screen Output: Graphics Output (UEFI), 1680 x 1050
So the bottom line answer to this question is, the new MBPs use EFI 1.1, not UEFI 2.x. And this is a problem for EFI booting Windows 7 as well as (U)EFI booting pretty much any other OS out there other than Mac OS X.
So EFI is for Apple, and BIOS is for everyone else. Which irks me because Apple would have better compatibility had they stuck with BIOS based hardware until they were ready/willing to go to UEFI. So all this talk about openness and extensibility and benefits of Apple's use of EFI in reality falls flat on its face.”
Apple's "EFI 1.10" implementation is actually UEFI 2.0 compatible on TB2 and TB3 Macs. Your MBP10,1 has an older firmware which doesn't support Windows Boot Camp UEFI installation.
Nevertheless, do you know of cases successfully driving a fully BIOS-incompatible card like the Sapphire RX 480 in any kind of "hacked" EFI Windows on these pre-late 2013 models? (The TB1 tests here in some of the articles must have been done with BIOS-compatible cards, not a Sapphire.)
Sapphire Nitro RX 480 has a dual BIOS but apparently its purpose is a different power profile: http://www.legitreviews.com/sapphire-nitro-radeon-rx-480-4gb-video-card-review_184553
It could be switching UEFI/legacy vBIOS as well. Nowadays every card contains an UEFI rom. If a Windows flag appears on your eGPU monitor during the boot, it signifies that your AMD card is UEFI compatible with the UEFI Mac (Late 2013->).
I’m not sure whether pre-UEFI MBP would work better with the legacy vBIOS card.
@goalque can we use that if we already have BOOTCAMP working part (i don't have knowledge of UEFI/rEFInd, i used only BOOTCAMP, and i want to know can i use this steps if i already have a working BOOTCAMP part) or we must make new clean UEFI Windows 10 install?
The question is because i just ordered 15' Retina Macbook Pro (late-2013) Iris Only and i want to be ready with all solutions to make it work with my current eGPU, i want to force Optimus!
@enjoy: MBP11,2 (Late 2013/Mid 2014) is a great choice and supports UEFI. After the apple_set_os.efi has been applied, and Nvidia drivers installed, you should have out of the box Optimus on Win8.1/Win10 Boot Camp.
@goalque so i must install Windows without Bootcamp, like this user?
@enjoy: Just follow these steps:
You can also download the Boot Camp support software separately in the Boot Camp Assistant (Action -> Download Windows Support Software).
I can install Windows and i now have it, i want to know what i must make and when. So to make all clear please answer me:
- Can i install your steps on my current Bootcamp partition or i must make clean install?
If i understand right - this steps will rebuild my Bootcamp part as EFI Boot right?
I don’t know how or where your current "Bootcamp partition" is installed and how you are going to move it from the other Mac. Twocanoes’ Winclone is possible. However, you need new Boot Camp support software.
For your new Late 2013 Iris Pro only MBP, I recommend a fresh installation of Win10 from the Boot Camp assistant, then you can proceed with the steps listed on the first post of this thread.
I recall there was “Make EFI Bootable” option in Winclone. I suppose it means UEFI. Make sure it’s turned on if you go this route.
@goalque Big thanks again. I just, right click of my recovered BOOTCAMP partition in WinClone – and click “Make EFI Bootable” it’s work like a charm!
So you can add this to your first post – it’s easy and tested:
MacBook Pro (Retina, 15-inch, Later 2013) 3.2GHz Quad Core Intel i7-4750HQ / 8 GB 1600 MHz DDR3 / 256GB SSD + 1TB
✪ mini eGPU ● PCI Express vs. Thunderbolt ● Mac CAN game ● Gaming Laptops vs. MacBook Pro with eGPU