What about a USB audio adapter or USB headphones as the default audio device? They're fairly cheap and pigtail adapters could be taped in a position that made them more accessible than the rear headphone port. I use SwitchAudioSource tripped by a login policy to keep sound running through USB headphones in a language lab.
https://github.com/deweller/switchaudio-osx
@joshuasee thank you for your response. I apologize for leaving this out of my description but we have a huge issue with theft so we are unable to attach any usb or headphones to the audio out port. Could switchaudio still be used if I am unable to leave anything plugged in?
Cable cooties are your friend. We used them on keyboards and mice until USB peripherals became common enough that theft wasn't a problem.
I tested SwitchAudioSource, and unfortunately it sees a "Built-In Audio Output", which is correct, when either speakers or headphones are in use. macOS has a way to detect when the headphone port is in use, but I don't know how to find it programmatically.
@nvidia
you could re-purpose a script i wrote here
How about physically disconnecting the speakers?
Thanks everyone! @LSinNY I will try to re-purpose the script.