How to disable USB Mass Storage Device in macOS Mojave I have been searching a solution on how to disable the USB ports on Mac mini to prevent data copy to external USB mass storage devices. Precisely, my purpose is not to let Mac mini read/write data from/into USB devices.

According to this post  ,kextunload command could be employed to accomplish this task in previous versions such as Sierra.

The problem that made me mad is there is only IOUSBMassStorageDriver.kext, but not IOUSBMassStorageClass.kext existing in /System/Library/Extensions/ directory. 
In addition, after running sudo kextunload -b com.apple.iokit.IOUSBMassStorageDriver, 
the below error keeps occurring.

(kernel) Can't remove kext com.apple.iokit.IOUSBMassStorageDriver; services failed to terminate - 0xdc008018.
Failed to unload com.apple.iokit.IOUSBMassStorageDriver - (libkern/kext) kext is in use or retained (cannot unload).


Anyone got any ideas? I really need help from this community.
Is it okay if the usb is recognized, but isn't mounted? When a drive is recognized but not mounted, and your SIP is enabled, system apps with the right entitlements might still be able to read/write directly to the disk, but most system and 3rd-party applications won't be able to write to the disk. If so, try disk arbitrator (download: https://github.com/aburgh/Disk-Arbitrator/releases). I'm sure most people know this already, but maybe someone will benefit from knowing this. I hope this helps.