Updated June 10th, 2019.
If your Mac’s sound isn’t playing properly– maybe it’s coming through the built-in speakers but you want it to play through the headphones– check the settings in the Sound preference panel. You can go to the Apple menu, then Sound, but it’s quicker and easier to hold the Option key down and click on the Sound icon in the menubar. Instead of seeing a volume slider, as you would without the Option key, you’ll see choices for Output (and also Input). Make your choice and you’re done. See below.
If you don’t see a Sound menu in the menu bar, go to System Preferences / Sound one more time, and check the box for “Show volume in menu bar.” (Except you’re going to get a lot more than “Volume” in the menu bar, because you know about this Option-click business!)