When you attach the Lightning connector to an iPhone or iPad you hear a chime and also get shown a battery icon displaying current charge levels.
Did you know you can make this happen on a MacBook/MacBook Pro/MacBook Air too? This can be useful if you want to ensure you’ve attached the MagSafe/USB C connector correctly. Just the other day I thought I had but came back to find my MacBook dead because the connector was hanging off slightly.
Just open a Terminal window (it’s in the Utilities folder of the Applications list) and paste-in the following, which is a single line:
defaults write com.apple.PowerChime ChimeOnAllHardware -bool true;open /System/Library/CoreServices/PowerChime.app &
(If you know how to examine the command you’ll see that it starts a background service for the chime. There’s no need to configure this background service to start in future because the defaults write command does that for us. In other words, this will persist across reboots.)
The chime will always sound from now on when the MagSafe is attached but the battery percentage figure will only appear when you attach the power when the device is in sleep mode (that is, the screen is black). Note that this also means that attaching the power when the device is asleep will temporarily wake it too, although the Mac appears to go straight back to sleep within a second or so.
Note that the chime will sound EVEN IF the volume is muted.
Interestingly the chap who discovered this trick – developer Zachary Waldowski – also uncovered code saying that the trackpad on Macs with Force Touch should also vibrate when the MagSafe is attached. However, on my MacBook Pro 2015 this doesn’t happen.
To turn off this feature, again open a Terminal window and type the following:
defaults delete com.apple.PowerChime ChimeOnAllHardware