Jump to content
2% OFF CODE FOR WLMOUSE PRODUCTS! ×

[SCRIPT] Automating the installation of eGPU on OS X (inc display output)


euqlaog

Recommended Posts

I've ceased development of this script in favor of my EFI app. However, others are invited to continue its development on GitHub, for personal and non-commercial use only.

 

I recommend encryption. It doesn’t prevent rip off, but makes it a bit more difficult. The encrypt/decrypt mechanism is pretty trivial. I am sure that there are programmers out there who know how pipelines and I/O redirections work. You should be able to generate new encrypted copyright notices easily in the Terminal.

 

Please do not release anything under the MIT (v0.9.8), it would be VOID under the Apple’s SLA:

http://images.apple.com/legal/sla/docs/macOS1012.pdf

 


Nando suggested me to create a new thread how to get external monitors detected via Nvidia eGPU on OS X. Well, I did something more - a shell script with the following features:

 

- Detects your OS X product version and build version

- Lists available web drivers from Nvidia

- Automatic download and driver installation

- Automatic IOPCITunnelCompatible mods + web driver mod

- Detects your Mac board-id and enables eGPU screen output

- Confirmed: Mid 2014 15” rMBP Iris Pro, Late 2014 Mac mini

 

We know that new technologies, including TB3, USB-C, and Apple’s Metal API in OS X 10.11 most likely bring external GPUs to a completely new level, so I try to keep this post up to date.

 

The script is designed to work in any Mac / OS X version (if the web driver is available from Nvidia) and it tries to determine correct driver download path by data scraping techniques. Installation takes place within the Terminal. You don’t have to double click the pkg. Just press “y” to questions. This is the first version, but already confirmed to work with two Macs.

 

Instructions:

1) Download the script on your desktop

 

The latest version:

curl -o ~/Desktop/automate-eGPU.sh https://raw.githubusercontent.com/goalque/automate-eGPU/master/automate-eGPU.sh

 

2) chmod +x ~/Desktop/automate-eGPU.sh

3) cd ~/Desktop

4) sudo ./automate-eGPU.sh

 

UPDATE:

Version 0.9.9 is released with new licensing:

Copyright (c) 2016 Goalque

 

1. You are free to modify and redistribute the script, as long as the above copyright notice 

    and this list of conditions are retained.

2. Backward modification or merging with earlier versions is prohibited, including changes to support macOS Sierra as described in issue #31.

3. No one is allowed to wrap the script into an installation tool or execute it from another program or script.

    No one is allowed to modify Apple's copyrighted binary files.

4. You may not use this script for commercial purposes.


What’s new in 0.9.9:

* native support (experimental) for R9 Nano and RX 480 with a Baffin personality

* Nvidia web driver support (experimental) for macOS Sierra beta builds

 

What's new in 0.9.8

- Support for OS X Mavericks 10.9.5 and Kepler cards
- Added board-ids for iMac15,1 and iMac17,1
- Fixed issue #8
- Fixed issue #9 (thanks keymone)
- Fixed issue #13

 

What's new in 0.9.7

- SetIOPCIMatch() function which sets and appends device IDs (both the AMD and Nvidia)

- Automatic NVIDIA Driver Manager uninstalling

- Minor bug fixes

 

What's new in 0.9.6

- Detects dGPUs for determining the correct [-a] mode behaviour

- Fixed issue #3 https://github.com/goalque/automate-eGPU/issues/3

- Fixed issue #4 https://github.com/goalque/automate-eGPU/issues/4

- Checks for the existence of application support path and if the script is ran as root

- Support for OS X El Capitan 10.11 beta 7 (15A263e)

 


- Native AMD support, masks for any card if codename is found

- Possible to use Nvidia official driver for Kepler cards [-skipdriver]

- Detects Thunderbolt connection

- Detects GPU name by scraping device id from The PCI ID Repository

- Hot-plugging required

- Automatic backups with rsync

- Uninstalling with [-uninstall] parameter

- OpenCL benchmarking (https://github.com/krrishnarraj/clpeak)

  • Thumbs Up 30
Link to comment
Share on other sites

Yes, the terminal is a very powerful tool :) It should work even if you have already pre-installed web driver or modified kexts (correctly), but there might be situations that it cannot handle. Feedback is welcome!

Link to comment
Share on other sites

Tested on Late 2013 15” rMBP Iris Pro, External Display and eGPU is now working, epic! :joyous:

post-32580-1449500029506_thumb.png

But I have that errors from script:

Error 17 File Exists, but there is no any file with name expanded.pkg on the desktop and it wasn't there. :suspicion:

post-32580-14495000295457_thumb.png

post-32580-14495000294374_thumb.png

  • Thumbs Up 2
Link to comment
Share on other sites

Tested on Late 2013 15” rMBP Iris Pro, External Display and eGPU is now working, epic! :joyous:

But I have that errors from script:

Error 17 File Exists, but there is no any file with name expanded.pkg on the desktop and it wasn't there. :suspicion:

Thanks!

- Are you sure that you didn’t have your own “expanded.pkg” on your desktop before running the script? I should add check or force delete if there exists such a file.

- Did you run the script with sudo?

- The expanded.pkg is a temporary file, it will be deleted right after web driver modification (in order to pass validateHardware/validateSoftware checks). If you try to run the script again, do you still see “file exists” error? Answer “n” if you see error messages.

- You have previously added manually IOPCITunnelCompatible keys, that’s why it notifies “Entry already exists”. This is a known issue.

Link to comment
Share on other sites

Hey Goalque,

first of all, I want to express my deepest respect for this amazing work. I think this is a huge step forward – towards a "install and then plug and play"-solution. Really great job, I cannot appreciate that enough.

I tried it with a Macbook Air 13" (mid-2013, OS X 10.10.3) with a Gigabyte GTX 750Ti Windforce + Sonnett Echo SE II. Unfortunately, the card is just detected as Nvidia chip model afterwards but as this was not my first try to use this card, I'm beginning to think that the card is the problem and not the setup. I'll try out another card as soon as I can get it. Will keep you posted if it works with that.

Link to comment
Share on other sites

Maybe some suggestions:

1) I tried it on the 10.10.4 Beta and (of course) it doesn't detect the driver from NVIDIA. Maybe you could add an exit to the script there because it was searching forever at this point.

2) Sometimes it might be good just to do the kext-thing e.g. – maybe you could implement a settings-variable where the user can choose with which step to start. :)

3) It'd be cool to have the same backwards. I.e. if your script would backup the kexts and a complementary script could undo everything if necessary.

4) What would you think about (optionally?) implementing the CUDA-installation as well?

PS: Sorry for the ongoing updating, I'm just really exited about this.

  • Thumbs Up 1
Link to comment
Share on other sites

Maybe some suggestions:

1) I tried it on the 10.10.4 Beta and (of course) it doesn't detect the driver from NVIDIA. Maybe you could add an exit to the script there because it was searching forever at this point.

2) Sometimes it might be good just to do the kext-thing e.g. – maybe you could implement a settings-variable where the user can choose with which step to start. :)

3) It'd be cool to have the same backwards. I.e. if your script would backup the kexts and a complementary script could undo everything if necessary.

4) What would you think about (optionally?) implementing the CUDA-installation as well?

PS: Sorry for the ongoing updating, I'm just really exited about this.

Great development ideas! :) Yes, data scraping method is not perfect yet. The user should check if the first item of the list build version matches to “Your build version”.

CUDA is only required if you run GPGPU apps, which use CUDA. Technically possible to automate this as well.

@Dschijn, @Simurgh5, @Shez:

As Dschijn told, the current directory must be ~/Desktop. I will try to fix this, but “cd ~/Desktop” is a solution for now. I am curious about 2015 Mac models, we have seen some unsuccessful tries on OS X as well.

Link to comment
Share on other sites

Ran a lot of benchmarks and it worked really good. But in Luxmark I can only run LuxBall and not Hotel Lobby or Neumann TLM.102 SE.

Added benchmarks in my guide: http://forum.techinferno.com/implementation-guides-apple/9821-2014-15-macbook-pro-iris-gtx970%4016gbps-tb2-akitio-thunder2-win8-1-%5Bdschijn-2%5D.html#post131966

Link to comment
Share on other sites

@Shez: Was the eGPU switched on during the installation? Or was it turned off, installed everything and rebooted with eGPU?

Fully off and not connected, rebooted with eGPU after installation.

- Are you sure that you didn’t have your own “expanded.pkg” on your desktop before running the script? I should add check or force delete if there exists such a file.

Yes I'm sure.

- Did you run the script with sudo?

Without sudo, looks like I missed sudo word being so exciting from this script

I think you should add force permission check before start the script, if possible. And if someone is already installed Web driver but want only activate eGPU screen output, your script doesn't allow that at that state of version of course ;)

  • Thumbs Up 1
Link to comment
Share on other sites

post-36170-14495000360068_thumb.jpgHi guys,

can you give me some advice how to select my eGPU after using the script?

Nvidia taskbar icon, syssettings panel active, Web Driver is selected, I see both cards in sysinfo but on the screen tab only iGPU is "active".

I'm on OSX 10.10.2

my terminal log:

air:~ user$ chmod +x ~/Desktop/automate-eGPU.shair:~ user$ cd ~/Desktop/

air:Desktop user$ sudo ./automate-eGPU.sh

Password:

Your OS X version: 10.10.2

Your build version: 14C1514

Searching available drivers...

Found the following matching drivers:

-------------------------------------

346.01.01f01 for 10.10.2 (14C1514)

343.02.02f04 for 10.10.2 (14C1514)

-------------------------------------

Newest driver:

http://us.download.nvidia.com/Mac/Quadro_Certified/346.01.01f01/WebDriver-346.01.01f01.pkg

Do you want to download this driver to your desktop (y/n)?

y

% Total % Received % Xferd Average Speed Time Time Time Current

Dload Upload Total Spent Left Speed

100 48.0M 100 48.0M 0 0 1449k 0 0:00:33 0:00:33 --:--:-- 9593k

Driver downloaded.

Modifying driver...

Driver mod done. Do you want to install (y/n)?

y

installer: Package name is NVIDIA Web Driver 346.01.01f01

installer: Installing at base path /

installer: The install was successful.

installer: The install requires restarting now.

IOPCITunnelCompatible mods done.

Add: ":IOKitPersonalities:AppleGraphicsDevicePolicy:ConfigMap:Mac-35C1E88140C3E6CF" Entry Already Exists

Nvidia eGPU screen output enabled.

IOBluetoothHostControllerUARTTransport.kext has no Info.plist file.

IOBluetoothHostControllerUARTTransport.kext has no Info.plist file.

IOBluetoothHostControllerUARTTransport.kext has no Info.plist file.

IOBluetoothHostControllerUARTTransport.kext has no Info.plist file.

IOBluetoothHostControllerUARTTransport.kext has no Info.plist file.

All ready. Please restart the Mac.

air:Desktop user$

post-36170-14495000359739_thumb.jpg

Link to comment
Share on other sites

@Dschijn: Air -Apple TB-Cable-> Akitio -Akitio TB-Cable-> LGI even switched TB ports on the Akitio, detached Akitio and switched to default gfx driver and back on; nothing.--checked kext files for CFBundleIdentifier:
/System/Library/Extensions/NVDAStartup.kext/Contents/Info.plist/System/Library/Extensions/IONDRVSupport.kext/Info.plist[FONT=Consolas]/System/Library/Extensions/AppleHDA.kext/Contents/PlugIns/AppleHDAController.kext/Contents/Info.plist[/FONT]
[FONT=Consolas]<[/FONT][FONT=Consolas]key[/FONT][FONT=Consolas]>IOPCITunnelCompatible[/FONT][FONT=Consolas]key[/FONT][FONT=Consolas]>[/FONT][FONT=Consolas]<[/FONT][FONT=Consolas]true[/FONT][FONT=Consolas]/>[/FONT]
^ was missing a couple of times, reboot but no luck.
Link to comment
Share on other sites

Quote

@Dschijn: Air -Apple TB-Cable-> Akitio -Akitio TB-Cable-> LGI even switched TB ports on the Akitio, detached Akitio and switched to default gfx driver and back on; nothing.--checked kext files for CFBundleIdentifier:

/System/Library/Extensions/NVDAStartup.kext/Contents/Info.plist/System/Library/Extensions/IONDRVSupport.kext/Info.plist[FONT=Consolas]/System/Library/Extensions/AppleHDA.kext/Contents/PlugIns/AppleHDAController.kext/Contents/Info.plist[/FONT]
[FONT=Consolas]<[/FONT][FONT=Consolas]key[/FONT][FONT=Consolas]>IOPCITunnelCompatible[/FONT][FONT=Consolas]key[/FONT][FONT=Consolas]>[/FONT][FONT=Consolas]<[/FONT][FONT=Consolas]true[/FONT][FONT=Consolas]/>[/FONT]
^ was missing a couple of times, reboot but no luck.



Where's that second TB cable from Akitio to LG plugged into? The Akitio itself, second port? That way you'd be daisy chaining it with your Macbook which won't let it be powered by the eGPU. Attach the monitor directly to the graphics card.
Link to comment
Share on other sites

No no no no no… you are connecting a Thunderbolt display to the 2nd TB port on the AKiTiO? That is daisy chaining TB devices and by that your LG is directly connected to the MacBook. To get eGPU display output, you have to connect the display to the output ports of the GPU you are using and not the TB device hosting it.

Link to comment
Share on other sites

I know, it is an insanely simple modification but here is a shortened version that allows you to start with any Version of the Nvidia Driver lying on the desktop (~/Desktop/WebDriver.pkg). I found it useful while trying the OS X 10.10.4 beta driver.

#!/bin/sh#

# Script (automate-eGPU.sh)

# This script automates Nvidia eGPU setup on OS X.

#

# Version 0.9 - Copyright © 2015 by goalque ([email protected])

#

# - Detects your OS X product version and build version

# - Lists available web drivers from Nvidia

# - Automatic download and driver installation

# - Detects your Mac board-id and enables eGPU screen output

# - Confirmed: Mid 2014 15” rMBP Iris Pro, Late 2014 Mac mini

#

echo "Modifying driver..."

pkgutil --expand ~/Desktop/WebDriver.pkg expanded.pkg

sed -i '' -E "s/if \(\!validateHardware\(\)\) return false;/\/\/if \(\!validateHardware\(\)\) return false;/g" ~/Desktop/expanded.pkg/Distribution

sed -i '' -E "s/if \(\!validateSoftware\(\)\) return false;/\/\/if \(\!validateSoftware\(\)\) return false;/g" ~/Desktop/expanded.pkg/Distribution

pkgutil --flatten ~/Desktop/expanded.pkg ~/Desktop/WebDriver.pkg

rm -rf ~/Desktop/expanded.pkg

echo "Driver mod done. Do you want to install (y/n)? "

read answer

if echo "$answer" | grep -iq "^y" ;then

volume_name=$(diskutil info / | awk '/Volume Name/ {print substr ($0, index ($0,$3))}')

/usr/sbin/installer -target /Volumes/"$volume_name" -pkg ~/Desktop/WebDriver.pkg

else

echo "Ok."

exit

fi

/usr/libexec/PlistBuddy -c "Add :IOKitPersonalities:1:IOPCITunnelCompatible bool true" /System/Library/Extensions/IONDRVSupport.kext/Info.plist

/usr/libexec/PlistBuddy -c "Add :IOKitPersonalities:2:IOPCITunnelCompatible bool true" /System/Library/Extensions/IONDRVSupport.kext/Info.plist

/usr/libexec/PlistBuddy -c "Add :IOKitPersonalities:3:IOPCITunnelCompatible bool true" /System/Library/Extensions/IONDRVSupport.kext/Info.plist

/usr/libexec/PlistBuddy -c "Add :IOKitPersonalities:NVDAStartup:IOPCITunnelCompatible bool true" /System/Library/Extensions/NVDAStartup.kext/Contents/Info.plist

/usr/libexec/PlistBuddy -c "Add :IOKitPersonalities:BuiltInHDA:IOPCITunnelCompatible bool true" /System/Library/Extensions/AppleHDA.kext/Contents/Plugins/AppleHDAController.kext/Contents/Info.plist

echo "IOPCITunnelCompatible mods done."

sudo /usr/libexec/PlistBuddy -c "Add :IOKitPersonalities:AppleGraphicsDevicePolicy:ConfigMap:"$(ioreg -c IOPlatformExpertDevice -d 2 | grep board-id | sed "s/.*<\"\(.*\)\">.*/\1/")" string none" /System/Library/Extensions/AppleGraphicsControl.kext/Contents/PlugIns/AppleGraphicsDevicePolicy.kext/Contents/Info.plist

echo "Nvidia eGPU screen output enabled."

nvram boot-args="kext-dev-mode=1 nvda_drv=1"

touch /Extensions

kextcache -system-caches

echo "All ready. Please restart the Mac."

Link to comment
Share on other sites

The next version includes:

- detects if your system has been updated and suggests reinstallation

- if the new driver is not yet available from Nvidia after OS X update (for example 10.10.4), it can modify the previous driver on the desktop and reinstall it within the terminal automatically

- bug fixes, much better error handling if the web driver is not found

  • Thumbs Up 3
Link to comment
Share on other sites

@ Dschijn + Morv:

thanks for pointing that out, I thought it would be logical to use the same kind of (TB) port for the screen.

Anyway, by the time you answered I already threw out all that nvidia stuff.

So I just reinstalled the script (new version) and connected though DP to my LG but the only difference is in sysinfo: the LG screen is now assigned to my gtx 970.

But on the screen tab you can see that only iGPU is used for both screens, web driver is selected.

Air -original TB cable-> Akitio -DP cable-> LG

tried switching drivers with and without TB cable attached

thanks for your support :)

post-36170-14495000360366_thumb.jpg

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.