If you want to enable duplex printing via a terminal command (e.g., trying to fix a bunch of already-installed printers with duplex disabled, and you want to fix that with a script), first you have to figure out what parameter to change.
On one Mac with the printer installed, find the printer via System Preferences > Printers & Scanners and then go to Options & Supplies and then Options to see if duplex printing is on. If it's not on, turn it on via point and click.
Then, in the terminal, put in this command, substituting in the name of your printer for printername:
lpoptions -p printername -l
You should see a bunch of output. In the output, you may see a line referring to APOptionalDuplexer
In my case, I was trying to script duplexing for an HP printer, so the latter showed up this way:
HPOption_Duplexer/Duplex Unit: *True False
The asterisk next to True
means it's set to true. You'll notice if you turn the duplex option off and then run that same command again, the asterisk will be next to False
Once you figure out the option you want, the command to enable duplex printing as an option should look something like this:
lpadmin -p printername -o APOptionalDuplexer=True
lpadmin -p printername -o HPOption_Duplexer=True
Acknowledgements: This is based on a helpful post from Mac Rumors from the thread enable "Duplex Printing Unit" in command prompt?