How do I uninstall and remove a .kext on Mac OS X?

Solution 1:

If you don't know the name of the .kext file you can figure it out by using a QuickLook plugin like Suspicious Package if the installer is a standard package (.pkg or .mpkg) that opens in Installer.app.

If it's not a package you can find out the name of the kext from the kernel panic: You can find this information at ~/Library/Logs/panic.log or when you restart your computer after the panic it will ask if you want to report the error to Apple. Press Report and then click the centre tab to see the crash details.

An example would be:

panic(cpu 0 caller 0x0035C330): freeing free mbuf
Backtrace, Format - Frame : Return Address (4 potential args on stack) 
0x2545bc08 : 0x128d08 (0x3c9afc 0x2545bc2c 0x131de5 0x0) 
0x2545bc48 : 0x35c330 (0x3ea258 0x3ae65000 0x23935100 0x493e0) 
0x2545bc88 : 0x7424a4 (0x36f19300 0x493e0 0x0 0x134b11) 
0x2545bca8 : 0x9f1458 (0x23935000 0x36f19300 0x0 0x0) 
0x2545bcd8 : 0x9ef6d6 (0x23935000 0x36f19300 0x0 0x0) 
0x2545bcf8 : 0x9fa0ce (0x23935000 0x36f15f00 0x1000000 0x0) 
0x2545bea8 : 0x9f375a (0x23935000 0x3a14880 0x40000000 0x34fb8b) 
0x2545bf08 : 0x398f79 (0x23935000 0x3a14880 0x1 0x13becf) 
0x2545bf58 : 0x39814b (0x3a14880 0x4121d48 0x4121d8c 0x0) 
0x2545bf88 : 0x397e81 (0x3a184c0 0x5d3734 0x452084 0x40431f4) 
0x2545bfc8 : 0x19a77c (0x3a184c0 0x0 0x19d0b5 0x696543c) Backtrace terminated-invalid frame pointer 0x0  

Kernel loadable modules in backtrace (with dependencies):
com.apple.iokit.AppleYukon(1.0.9b3)@0x9ed000  

dependency: com.apple.iokit.IONetworkingFamily(1.5.1)@0x73b000
dependency: com.apple.iokit.IOPCIFamily(2.2)@0x60a000
dependency: com.apple.iokit.IOACPIFamily(1.2.0)@0x6b6000
com.apple.iokit.IONetworkingFamily(1.5.1)@0x73b000

Kernel version:
Darwin Kernel Version 8.8.2: Thu Sep 28 20:43:26 PDT 2006; root:xnu-792.14.14.obj~1/RELEASE_I386

I've set the relative lines apart. Specifically you're looking for the first line after "Kernel loadable modules...". In this case the item is com.apple.iokit.AppleYukon (which is the Ethernet driver/kernel extension) so the file name would be com.apple.iokit.AppleYukon.kext.

Before you go on to the next step be 110% sure you have the right kernel extension. Disabling the wrong kernel extension can make life really hard - eg. USB devices won't work until it's re-enabled.

Finally to unload it:

sudo kextunload /System/Library/Extensions/NAME_OF_THE_KEXT_FILE.kext

Solution 2:

You need to use the kextunload command. You may need to use sudo if it was installed as a System-wide (rather than individual user) kext.

You can also delete the kext bundle directly, and reboot.

Solution 3:

This is for hackintoshes, but I'm pretty sure the command line works for normal macs also...

http://ihackintosh.blogspot.com/2008/10/how-to-remove-kext-file-in-mac-osx.html

Be careful what you type in though :)