- Joined
- May 11, 2012
- Messages
- 83
- Motherboard
- ASUS Prime X299 Deluxe
- CPU
- i9 7900X
- Graphics
- EVGA GTX 1080Ti Founders Edition
- Mac
You may need to uninstall the Nvidia WebDriver from a CLI because you are only able to SSH back in to your bricked hackintosh following a failed WebDriver install. In such a circumstance it may be useful to know that the uninstaller can be invoked from a terminal.
Recall that the Nvidia PrefPane has an Uninstall option.
<TLDR>
As root, unpack /Library/PreferencePanes/NVIDIA\ Driver\ Manager.prefPane/Contents/MacOS/NVIDIA\ Web\ Driver Uninstaller.app/Contents/Resources/NVUninstall.pkg to a temporary location and run <unpacked>/Scripts/postinstall
</TLDR>
This is what I found poking around my bricked hack over SSH:
Recall that the Nvidia PrefPane has an Uninstall option.
<TLDR>
As root, unpack /Library/PreferencePanes/NVIDIA\ Driver\ Manager.prefPane/Contents/MacOS/NVIDIA\ Web\ Driver Uninstaller.app/Contents/Resources/NVUninstall.pkg to a temporary location and run <unpacked>/Scripts/postinstall
</TLDR>
This is what I found poking around my bricked hack over SSH:
Code:
root@x:/Library/PreferencePanes/NVIDIA Driver Manager.prefPane/Contents/MacOS/NVIDIA Web Driver Uninstaller.app/Contents# pkgutil --expand Resources/NVUninstall.pkg /tmp/foo
root@x:/Library/PreferencePanes/NVIDIA Driver Manager.prefPane/Contents/MacOS/NVIDIA Web Driver Uninstaller.app/Contents# ll /tmp/foo/
total 8
-rw-r--r-- 1 root wheel 475 5 Oct 17:10 PackageInfo
drwxr-xr-x 3 dwhitla admin 96 5 Oct 17:10 Scripts
root@x:/Library/PreferencePanes/NVIDIA Driver Manager.prefPane/Contents/MacOS/NVIDIA Web Driver Uninstaller.app/Contents# pushd /tmp/foo
/tmp/foo /Library/PreferencePanes/NVIDIA Driver Manager.prefPane/Contents/MacOS/NVIDIA Web Driver Uninstaller.app/Contents
root@x:/tmp/foo# ll
total 8
-rw-r--r-- 1 root wheel 475 5 Oct 17:10 PackageInfo
drwxr-xr-x 3 dwhitla admin 96 5 Oct 17:10 Scripts
root@x:/tmp/foo# cat PackageInfo
<?xml version="1.0" encoding="utf-8"?>
<pkg-info overwrite-permissions="true" relocatable="false" identifier="com.nvidia.combo-uninstall-pkg" postinstall-action="none" version="0" format-version="2" generator-version="InstallCmds-662 (17A347)" auth="root">
<bundle-version/>
<upgrade-bundle/>
<update-bundle/>
<atomic-update-bundle/>
<strict-identifier/>
<relocate/>
<scripts>
<postinstall file="./postinstall"/>
</scripts>
</pkg-info>root@x:/tmp/foo# ll
total 8
-rw-r--r-- 1 root wheel 475 5 Oct 17:10 PackageInfo
drwxr-xr-x 3 dwhitla admin 96 5 Oct 17:10 Scripts
root@x:/tmp/foo# ll Scripts
total 8
-r-xr-xr-x 1 dwhitla admin 3932 7 Sep 03:08 postinstall
root@x:/tmp/foo#cat Scripts/postinstall
#!/usr/bin/perl
#
# NVUninstall postinstall script
#
use strict;
print "Starting...\n";
## We only support uninstalling the Web Driver on the boot volume "/"
if ($ARGV[2] ne "/")
{
print "Error: invalid target \"$ARGV[2]\"\n";
exit(1);
}
my $appSupportPath = "/Library/Application Support/NVIDIA";
my $osBuild = `defaults read /System/Library/CoreServices/SystemVersion.plist ProductBuildVersion`;
chomp($osBuild);
## Create a directory in /tmp to move items for deletion to
my $uuid = `uuidgen`;
chomp($uuid);
my $ToBeDeleted = "/tmp/$uuid";
mkdir($ToBeDeleted, 0755);
print "Clearing NVRAM settings\n";
removeWebDriverBootArg();
print "Removing pref pane launchd plists\n";
removePrefPaneLaunchdPlists();
print "Removing pref pane bundle\n";
removePrefPaneBundle();
print "Removing var tmp directories\n";
removeVarTmpDirs();
print "Removing driver components\n";
removeWebDriverComponents(); # now /Library/Extensions too
print "Removing legacy web release files\n";
removeLegacyWebReleaseFiles();
print "Removing preference files\n";
removeNVUserPrefs();
print "Done\n";
##################################
## Work routines from here down ##
##################################
sub removeNVUserPrefs()
{
my @users = `ls /Users 2> /dev/null`;
foreach my $user (@users)
{
chomp($user);
##
## for some reason, `ls` includes entries that start
## with dot. so, explicitly skip it here.
##
next if ($user =~ /^\./);
my $prefsPath = "/Users/$user/Library/Preferences/ByHost";
my @prefs = `ls $prefsPath/com.nvidia.nvagent.* $prefsPath/com.nvidia.nvprefpane.* 2> /dev/null`;
foreach my $pref (@prefs)
{
chomp($pref);
stageToDelete($pref);
}
}
}
sub removeLegacyWebReleaseFiles()
{
stageToDelete("/Library/Application Support/NVIDIA/NVIDIA Driver Restore.mpkg");
stageToDelete("/usr/bin/NVIDIARecovery");
}
sub removeWebDriverComponents()
{
# also works with old kext location
my @les = `/bin/ls -1 /Library/Extensions | egrep '^NVDA.*Web.kext\$|^GeForce.*Web.*\$'`;
my @sles = `/bin/ls -1 /System/Library/Extensions | egrep '^NVDA.*Web.kext\$|^GeForce.*Web.*\$'`;
foreach my $le (@les)
{
chomp($le);
stageToDelete("/Library/Extensions/$le");
}
foreach my $sle (@sles)
{
chomp($sle);
stageToDelete("/System/Library/Extensions/$sle");
}
}
sub removePrefPaneLaunchdPlists()
{
my $agentPlist = "/Library/LaunchAgents/com.nvidia.nvagent.plist";
my $helperPlist = "/Library/LaunchDaemons/com.nvidia.nvroothelper.plist";
# Delete agent plist
stageToDelete($agentPlist);
## Delete root helper plist
stageToDelete($helperPlist);
}
sub removePrefPaneBundle()
{
stageToDelete("/Library/PreferencePanes/NVIDIA Driver Manager.prefPane");
}
sub removeVarTmpDirs()
{
my @files = qw(nvmenu nvprefpane nvagent nvroothelper);
foreach (@files)
{
stageToDelete("/var/tmp/com.nvidia/com.nvidia.$_");
}
}
sub stageToDelete($)
{
my $path = shift;
if (-e $path)
{
system("/bin/mv -f '$path' $ToBeDeleted/.");
}
}
sub removeWebDriverBootArg()
{
##
## $ nvram boot-args
## boot-args debug=0x14e -v nvda_drv=1
##
## Create array of args from nvram
my @args = split(/\s/, `nvram boot-args 2> /dev/null`);
## remove "boot-args" at the beginning
shift(@args);
## remove "nvda_drv" and "nvda_drv=*"
my @cleanArgs = grep {!/^nvda_drv$/ && !/^nvda_drv=/} @args;
## skip nvram if nothing has changed
if (@args != @cleanArgs)
{
if (@cleanArgs)
{
system("/usr/sbin/nvram boot-args=\"@cleanArgs\"");
}
else
{
## if the new args is empty, delete the boot-args entry.
system("/usr/sbin/nvram -d boot-args");
}
}
}