When you connect a power source to an iPhone, iPad or iPod touch a familiar charging chime sound will trigger from the device, indicating that a cable is attached and the device is getting power. If you like hearing that auditory confirmation that a device is getting power, you can add the exact same audio playback feature to any MacBook Pro or MacBook Air. This requires OS X Yosemite (10.10.3 or better).

1. Disconnect the Mac from the MagSafe power source
2. Open the Terminal app, found in /Applications/Utilities
3. Enter the following command: 

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

4. Hit Return
5. Re-connect the MacBook power supply to hear the chime

 

If you want to disable the sound effect, launch Terminal and type the following in:

defaults write com.apple.PowerChime ChimeOnAllHardware -bool false;killall PowerChime