Skip to content

Commit

Permalink
Remove nvram-restore option
Browse files Browse the repository at this point in the history
  • Loading branch information
mayankk2308 committed Jan 28, 2018
1 parent c16a45e commit b2251c9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 28 deletions.
17 changes: 5 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,7 @@ $ sudo ./purge-nvda.sh nvram-only

This is useful for **iGPU-only** mode for the next boot only. Rebooting again will restore default behavior.

To restore nvram:
```bash
$ sudo ./purge-nvda.sh nvram-restore
```

This restores the NVRAM variables to how they were before running the script.

To completely uninstall changes (recommended):
To uninstall changes:
```bash
$ sudo ./purge-nvda.sh uninstall
```
Expand All @@ -74,13 +67,13 @@ $ sudo ./purge-nvda.sh help
## The Story
When **Apple** announced native external graphics support for macOS on **Thunderbolt 3** macs, I was ecstatic. Other eGPU users confirmed that it worked on older **Thunderbolt** macs. Being on the Mid-14 MBP w/ 750M, my enthusiasm quickly faded, however, as soon as I plugged in my eGPU and logged out (on High Sierra, of course) - all I could see on the external display was colored lines and glitches. Suspecting that **NVIDIA** drivers were to blame for this, I tried moving kexts associated with the same away from its default location to prevent loading, powered down the Mac, plugged in the eGPU, and booted. It worked (Beta 4)!

I was up and running on my external display - at the cost of no output on the internal display and losing the ability to boot without external graphics connected. So I decided to create a tiny script to help move about the kexts, making it easy to restore the system to its default configuration. Then **@theitsage** on [egpu.io](https://egpu.io) suggested I look into a [macrumors forum](https://forums.macrumors.com/threads/force-2011-macbook-pro-8-2-with-failed-amd-gpu-to-always-use-intel-integrated-gpu-efi-variable-fix.2037591/page-28#post-24886189) where mac users with failing AMD chips were using the same process to prevent the use of the chip - with one major difference - they were forcing boot on the iGPU. This was what I needed to get the internal display to work and ensure external graphics compatibility. This configuration worked on Beta 4, but does not on Beta 5.
I was up and running on my external display - at the cost of no output on the internal display and losing the ability to boot without external graphics connected. So I decided to create a tiny script to help move about the kexts, making it easy to restore the system to its default configuration. Then **@itsage** on [egpu.io](https://egpu.io) suggested I look into a [macrumors forum](https://forums.macrumors.com/threads/force-2011-macbook-pro-8-2-with-failed-amd-gpu-to-always-use-intel-integrated-gpu-efi-variable-fix.2037591/page-28#post-24886189) where mac users with failing AMD chips were using the same process to prevent the use of the chip - with one major difference - they were forcing boot on the iGPU. This was what I needed to get the internal display to work and ensure external graphics compatibility. This configuration worked on Beta 4, but does not on Beta 5.

After investigating, thanks to **@goalque** and **@tbl777** on [egpu.io](https://egpu.io), we discovered that only the **GeForce** kexts are to blame. Removing only those are sufficient for persistent iGPU-only boots. **1.2.1** is the first release to support **High Sierra**.
After investigating, thanks to **@goalque** and **@tbl777** on [egpu.io](https://egpu.io), we discovered that only the **GeForce** kexts are to blame. Removing only those are sufficient for persistent iGPU-only boots.

Finally, on **macOS 10.13.4**, many bugs have been eliminated and **1.2.0** now allows for external AMD graphics to run on macs with discrete NVIDIA GPUs.
Finally, on **macOS 10.13.4**, many bugs have been eliminated and the script now allows for external AMD graphics to run on macs with discrete NVIDIA GPUs.

Due credit goes to the macrumors members (esp. **@nsgr**) on that forum for the **NVRAM** settings that make this possible without requiring a separate **ArchLinux** installation to manually manage these values.
Due credit goes to the MacRumors members (esp. **@nsgr**) on that forum for the **NVRAM** settings that make this possible without requiring a separate **ArchLinux** installation to manually manage these values.

## Disclaimer
This script moves core system files associated with macOS. While any of the potential issues with its application are recoverable, please use this script at your discretion. I will not be liable for any damages to your operating system.
Expand Down
25 changes: 9 additions & 16 deletions purge-nvda.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
#!/bin/sh
# Script (purge-nvda.sh) by mac_editor @ egpu.io ([email protected])
# Version: 1.2.3
# Version: 1.3.0

# Usage:
# sudo ./purge-nvda.sh -> moves NVDA kexts to prevent NVDA GPU activation and enables AMD eGPU support
# sudo ./purge-nvda.sh suppress-only -> Same as without arguments sans AMD eGPU support
# sudo ./purge-nvda.sh nvram-restore -> restores NVRAM
# sudo ./purge-nvda.sh nvram-only -> update only NVRAM
# sudo ./purge-nvda.sh uninstall -> restores NVDA kexts, resets NVRAM, and removes backup traces

Expand Down Expand Up @@ -62,11 +61,9 @@ usage()
No arguments: Suppresses dGPU + supports AMD eGPUs.
suppress-only: Only suppresses dGPU.
suppress-only: Suppresses dGPU.
nvram-only: Updates the NVRAM for iGPU-only mode.
nvram-restore: Restores the NVRAM to how it was before.
nvram-only: Only updates the NVRAM for iGPU-only mode.
uninstall: Restores system to pre-purge state.
Expand Down Expand Up @@ -130,31 +127,30 @@ restore_nvda_drv()

uninstall()
{
restore_nvram
if [[ -d "$backup_dir" ]]
then
restore_nvram
restore_nvda_drv
invoke_kext_caching
echo "Uninstalling..."
rm -r "$backup_dir"
final_message="Uninstallation complete.\n"
else
echo "Could not find valid installation. No action taken.\n"
exit
final_message="Could not find valid installation. NVRAM was restored.\n"
fi
}

initiate_reboot()
{
for time in {5..0}
do
printf "Restarting in $time s | Ctrl + C to cancel...\r"
printf "Restarting in $time s (Recommended)...\r"
sleep 1
done
reboot
}

proceed_exec()
proceed_purge()
{
update_nvram
final_message="Your mac will now behave as an iGPU-only device.\n"
Expand All @@ -167,17 +163,14 @@ if [[ "$operation" == "" ]]
then
check_macos_version
move_nvda_drv "true"
proceed_exec
proceed_purge
elif [[ "$operation" == "suppress-only" ]]
then
move_nvda_drv "false"
proceed_exec
proceed_purge
elif [[ "$operation" == "nvram-only" ]]
then
update_nvram
elif [[ "$operation" == "nvram-restore" ]]
then
restore_nvram
elif [[ "$operation" == "uninstall" ]]
then
uninstall
Expand Down

0 comments on commit b2251c9

Please sign in to comment.