Skip to content

kextunload MacOS Command Guide

The MacOS kextunload command is used to unload kernel extensions on a Mac system. Kernel extensions are pieces of code that enhance the operating system’s functionality and help it communicate with hardware devices. With kextunload, users can unload these extensions when they are no longer needed, freeing up system resources and potentially resolving conflicts. This command can be particularly useful when troubleshooting issues related to hardware devices and drivers. By unloading specific kernel extensions, users can isolate problematic components and streamline the system’s operation. It is important to note that using the kextunload command requires administrative privileges and should be done with caution to avoid disrupting system stability.

kextunload Syntax:

Terminal window
kextunload [-b bundle_id] [-v] [-V] [-c bundle_id] [-t] [-q] [-b bundle_id [-v[v] [-t] [-q]]] [-h] [bundle_id ...]

Options:

OptionDescription
-b bundle_idSpecifies the bundle ID of the kext to be unloaded
-vVerbose output, display progress
-VVery verbose output, display even more information
-c bundle_idUnload the bundle specified and its dependents if possible
-tTest the kexts (unload will not occur)
-qQuiet, print only errors and warnings
-hDisplay usage help

Parameters:

ParameterDescription
bundle_idOne or more kext bundle IDs to be unloaded

kextunload Command Samples:

Unload a Kernel Extension by Bundle ID

Terminal window
sudo kextunload -b com.apple.driver.AppleHDAController

Unloads the kernel extension with the specified bundle ID “com.apple.driver.AppleHDAController”.

Unload a Kernel Extension by Kext Path

Terminal window
sudo kextunload /Library/Extensions/Example.kext

Unloads the kernel extension located at the specified path “/Library/Extensions/Example.kext”.

Unload Multiple Kernel Extensions

Terminal window
sudo kextunload -b com.test.kext1 -b com.test.kext2

Unloads multiple kernel extensions using their respective bundle IDs.

Unload a Kernel Extension and Verbose Output

Terminal window
sudo kextunload -v 3 -b com.test.kext

Unloads the kernel extension and provides verbose output at the specified verbosity level.

Unload a Kernel Extension with Force Option

Terminal window
sudo kextunload -f /System/Library/Extensions/Example.kext

Forces the unloading of the kernel extension located at the specified path.

Unload a Kernel Extension by Matching Identifier

Terminal window
sudo kextunload -b com.test.*.kext

Unloads kernel extensions matching the specified bundle identifier pattern.

Unload a Kernel Extension Quietly

Terminal window
sudo kextunload -q /Path/To/Example.kext

Unloads the kernel extension quietly without displaying any output.

kextunload FAQ:

How do I use kextunload in MacOS?

To use the kextunload command in MacOS, execute the following command:

Terminal window
kextunload --bundle-id com.example.kext

What is the purpose of kextunload in MacOS?

The kextunload command in MacOS is used to unload kernel extensions (kexts) from the running kernel.

Can I unload multiple kernel extensions at once with kextunload?

Yes, you can unload multiple kernel extensions at once by specifying multiple bundle identifiers in the kextunload command.

Terminal window
kextunload -b com.example.kext1 -b com.example.kext2

How can I force unload a kernel extension using kextunload?

To force unload a kernel extension with kextunload, use the ‘-f’ flag in the command.

Terminal window
kextunload -f --bundle-id com.example.kext

Is it possible to display verbose information while unloading a kernel extension with kextunload?

Yes, you can use the ‘-v’ flag to display verbose information while unloading a kernel extension.

Terminal window
kextunload -v --bundle-id com.example.kext

What should I be cautious about when using kextunload in MacOS?

When using kextunload, be cautious about unloading critical kernel extensions that are necessary for system stability. Improper unloading of essential extensions can lead to system instability or crashes.

Applications of the kextunload command

  • Unload a currently loaded kernel extension
  • Troubleshoot issues related to a specific kernel extension
  • Prepare for updating or replacing a kernel extension
  • Disable a problematic kernel extension temporarily