There’s optical digital line out up until the 2015 Macbook Pro, sending light out of the headphone jack. You need to add a little plastic adapter compared to standard TOSLINK cables, which I presume were getting too big.
It's interesting how silently they dropped the optical line out, I never saw it mentioned. I needed it for something on my iMac Pro the other week and was boggled that it didn't support it. The argument I read about it was the DAC is so high quality now, digital out is simply not needed.
I’m still slightly bemused as to why they dropped optical out from the Apple TV too. It’s not like it’s supposed to be a media hub at the centre of your house or they run a music streaming service or anything!
I specifically got a device to split audio out of the HDMI stream (technically it just copies it out) to RCA so I can pipe it back into the stereo in zone 2. Annoyingly complex but it works.
Optical out was a real blessing back when electrical connections (iMacs to amps) were noticeably noisy.
To go from optical back to electrical just seemed wrong from a tech evolution standpoint. Not hearing a lot of call to rip out multimode fiber in backbone networks and replace it with a shinier coax. But HDMI seems to be meeting the need, and there is always the aftermarket for fully annealed 99.999% oxygen-free HDMI cables to consider.