To entirely disable USB Mass Storage on mac you only need to remove the kernel extension IOUSBMassStorageClass.kext which can be found in “/System/Library/Extensions”. You need to be admin to perform this task and immediately restart the system.
By removing I don’t mean removing it from your file system but simply removing it from the folder with kernel extensions.
Many Thanks for reverting back. I have logged in as root user to do same but it is always showing me error “IOUSBMassStorageClass.Kext” can’t be modified or deleted because it’s required by OS x
You’re logged in as administrator I guess and the Finder will give a warning so users who are more aware of what they are doing will use the terminal. Some kernel extensions should not be (re)moved while other can. To be better safe than sorry the Finder won’t allow any changed to this folder, even when your administrator. So use the terminal for these kind of tasks.
ehemmete implied this is not really an “Apple” sort of way which is incorrect. Some kernel extensions are loaded when needed and are not required by OS X but only giving services to the OS, unlike the warning you’re getting. IOUSBMassStorageClass.Kext is such an kernel extension that is only loaded when there is an actual USB Mass Storage mounted and will be unloaded when it’s no longer required. When an USB device is connected and the kernel has no extension to load for the USB device nothing will happen. The direct system running (BSD) will not be notified nor will the desktop processes (Mac OS X) be notified that there is an USB Mass Storage attached.
But here is an more gentle approach:
In terminal: kextstat -kl
if IOUSBMassStorageClass is in the list the kernel extension is loaded; make sure there is no USB Mass Storage connected (unmounting is not enough)
In terminal: sudo kextunload -b com.apple.iokit.IOUSBMassStorageClass
if folder ‘/System/Library/Extensions Disabled’ does not exists then
In terminal: sudo mkdir ‘/System/Library/Extensions Disabled’
in terminal: cd /System/Library
sudo mv Extensions/IOUSBMassStorageClass.kext/ Extensions\ Disabled/
You now have gently unloaded the kernel extension and disabled it for further loading. To undo this task, when you ever need it to work again simply move the extension back into the extension folder.
Keep in mind though that some system updates can install a newer version of this extension and USB Mass storage is enabled again, you need to redo those steps.