since os x yosemite 10.10.3, mac users are able to add the charging chime, everyone knows from their ios devices. it's just this simple line to activate the setting:

defaults write com.apple.PowerChime ChimeOnAllHardware -bool true; open /System/Library/CoreServices/PowerChime.app

open terminal.app (which can be found in /applications/utilities), paste the entire line and press enter.

if you are sick of listening to this sound, just run the following command to deactivate the charging chime:

defaults delete com.apple.PowerChime; killall PowerChime
main picture by roman drits, license