How to completely uninstall the old kext driver?

Hi,

On macOS 11 and earlier versions, we provided users with the following script to uninstall our kext driver:

sudo pkgutil --only-files --files com.magewell.ProCapture | tr '\n' '\0' | xargs -n 1 -0 sudo rm -vf
sudo pkgutil --only-dirs --files com.magewell.ProCapture | grep ProCapture[^/]*$ | tr '\n' '\0' | xargs -n 1 -0 sudo rm -rvf
sudo pkgutil --forget com.magewell.ProCapture
sudo kextcache -system-caches

However, this script no longer works on macOS 13 and returns the following error:

It looks like you're trying to update the system caches. As of macOS 11, the personality cache is no longer in use for keeping kext matching information up-to-date. For more information, see `man kmutil`.

This indicates we can no longer use kextcache -system-caches to clear our driver cache. This creates an issue where even after installing the new dext driver, the dext driver cannot run due to the presence of the old kext driver. We've tried various methods but haven't been able to completely uninstall the old kext driver - after every new system update, the old kext reappears. The specific process is as follows:

This is the sequence I followed in my latest test
 - Device is running macOS 13 Ventura w/ 4247 Pro Capture kext driver installed
kmutil inspect | grep -i magewell
 - this returns references to the kext files in /Library/Extensions, which is expected because I have not yet removed the 4247 kext driver
 - then I ran the following combination of your removal script and my removal steps:
cd /
sudo rm -r /Library/Extensions/ProCaptureDriver.kext
sudo rm -r /Library/Extensions/ProCaptureEvent.kext
sudo rm /System/Volumes/Preboot/*/boot/*/System/Library/Caches/com.apple.kernelcaches/kernelcache.auxkc*
sudo pkgutil --only-files --files com.magewell.ProCapture | tr '\n' '\0' | xargs -n 1 -0 sudo rm -vf
sudo pkgutil --only-dirs --files com.magewell.ProCapture | grep ProCapture[^/]*$ | tr '\n' '\0' | xargs -n 1 -0 sudo rm -rvf
sudo pkgutil --forget com.magewell.ProCapture
sudo kextcache --clear-staging
sudo kcditto
sudo kmutil install --update-preboot
sudo shutdown -r now
 - After this I ran 'kmutil inspect | grep -i magewell' and got no results, which seems good but...
 - then I ran the upgrade to macOS 15.7 Sequoia
 - Afterwards I ran 'kmutil inspect | grep -i magewell' and it returned references to the old /Library/Extensions kexts again, although the files no longer exist in /Library/Extensions
 - I then ran my cleanup process again (slightly different for Sequoia-available commands):
sudo rm /System/Volumes/Preboot/*/boot/*/System/Library/Caches/com.apple.kernelcaches/kernelcache.auxkc*
sudo kextcache --clear-staging
sudo kmutil rebuild
sudo kcditto
sudo kmutil install --update-preboot
sudo shutdown -r now
 - Then I ran 'kmutil inspect | grep -i magewell' and got no results again
 - As a next test I ran a minor update to macOS 15.7.1, then ran 'kmutil inspect | grep -i magewell'  and the references to the old kexts came back again

We have indeed identified a solution to address this issue:

kmutil trigger-panic-medic --volume-root /Volumes/<YourVolumeName>

However, this method requires booting into Recovery Mode, which is unacceptable for many of our customers. Especially for those who need bulk remote management, having personnel physically operate each machine one by one is simply not feasible.

Therefore, is there a method to completely uninstall the kext driver while in normal mode?

Thank you!

Additional information:

  1. kmutil rebuild frequently fails:
% sudo kmutil rebuild
Checking the auxiliary kernel collection...
Error Domain=KMErrorDomain Code=31 "Error occurred while building a collection: Cannot build collection without binaries as only 1 codeless kexts provided" UserInfo={NSLocalizedDescription=Error occurred while building a collection: Cannot build collection without binaries as only 1 codeless kexts provided}
  1. Output from kmutil inspect on macOS 15.7:
% kmutil inspect
auxiliary kext collection at /System/Volumes/Preboot/DE1C1CE0-D3C6-403C-B5D8-56E6E003148C/boot/9334E85A7D36C17DBEE4F81854E2F1645866C0696EEA24433AC187CBE6575671EB84BD6D774A98804391CBAFCFC931CE/System/Library/Caches/com.apple.kernelcaches/kernelcache.auxkc.CAF862D59166BD22CE05B096DDC1685CA3725175A41E436AC4B1D29D8F89635C2B79BF606EDBCBDE1282FAEC5F559E73 (25966FB4-9792-D048-11B5-E51FCA0F69BB):
Extension Information:
com.magewell.ProCaptureDriver   1300.42.47      /Library/StagedExtensions/Library/Extensions/ProCaptureDriver.kext
com.magewell.ProCaptureEvent    1300.42.47      /Library/StagedExtensions/Library/Extensions/ProCaptureEvent.kext
How to completely uninstall the old kext driver?
 
 
Q