Disable ‘Eject’ menu option in OS X Finder

Disable the menu option: ‘File ▸ Eject [volume]’ (cmd⌘ + E) in the Mac OS X Finder menubar.

defaults write com.apple.finder ProhibitEject -bool true

To make the command take effect, you need to restart the Finder.

killall Finder

Revert to the default setting:

defaults write com.apple.finder ProhibitEject -bool false