System detects digital output when headphones plugged in, audio does not work I'm on a MacBook Pro (2013) running OS X El Capitan 10.11.6. The speakers work as usual, but when I plug in headphones, the audio stops working. When I remove the headphones, the speakers work again as before.

With headphones plugged in, the only output device available is "Digital Out - Optical digital-out port", and when I try to change the volume there is a disabled symbol (and no volume bar is displayed).

I have tried rebooting, using a different set of headphones, resetting the PRAM, and cleaning the port, all to no avail. I do not see a red light in the port as many other questions have mentioned.
Do you have a pair of OEM Apple headphones (from an iPhone or so)? There are some cases, that only the OEM headphones work, and 3rd party do not. If they do work, try the following:


Plug your headphones back in.
Play a bit of sound through them (e.g., a song), then stop the sound.
Make sure Preferences is quit.
Launch Preferences and open the Sound pane.
While the Sound pane is open and set to Headphones, pull out the headphone plug from the jack.
It will reset itself to "Internal Speakers" and you are good to go.