Reboot to recovery mode. Turn off SIP and secure boot. Boot back to normal mode.
Go to https://developer.apple.com/download/more/ and click "More" in the upper-right. Search for "Kernel". Download and install the Kernel Debug Kit for your build of macOS (run sw_vers
on the command line to get it. A nearby KDK will often work; installing one is harmless.
For the KDK, exact build number is best and should definitely work. Otherwise, after installing it, you can see if the release kernel in the KDK (e.g. /Library/Developer/KDKs/KDK_10.14.6_18G2016.kdk/System/Library/Kernels/
) matches the actual kernel (/System/Library/Kernels/kernel
) with diff/shasum/whatever. If they match, the KDK will probably work. If they don't, the KDK might work. Probably nothing horrible will happen if you try and it doesn't.
Once you decide to use a KDK (or not), install the development kernel:
sudo mount -uw /