I have a late 2013 iMac 21.5" with one of those 1/8" audio ports in back that doubles as a headphone jack and an optical digital audio out. So, I got a stereo recently and set it up nearish to the computer and plugged an optical audio cable from that port to the input on my receiver. Works perfectly. BUT: i can't see any way to (from the computer) switch back to the iMac speakers if i wasn't going to use the stereo. Use case: my wife doesn't want the computer audio to ALWAYS require that she turn on the stereo. She wants to be able to use the speaker symbol up in the menu bar and switch to iMac speakers. But near as i can tell there's no way to do that! I think you have to reach behind the computer and unplug the cable, then plug it back in when you want to use the stereo. That's a non-starter. We'd be doing that multiple X per day.
Oh, and I'm using MacOS High Sierra, latest version.
Oh, and I'm using MacOS High Sierra, latest version.