Setting the Default Printer

Technically, this isn’t a macro, but its very easy to set the default printer using the shell command lpoptions.

This command:

lpstat -a

will list out all your configured printers with their names.

And then

lpoptions -d PRINTERNAME

will set the default printer.

As usual, I found this while researching a support query, and I found it by the standard technique of doing a web search for:

AppleScript set the default printer

Note that the result is not an AppleScript at all, but AppleScript works as a great filter because it means the result is Mac-specific, and since AppleScript can execute shell scripts, it finds any shell commands like this as well.

2 Likes

That’s excellent!

Note that one should always search for a non-AppleScript solution too:

os x shell set printer

For instance.

It’s not uncommon to miss shell script solutions when you include AppleScript, because some of the geekier (most accomplished) scripters will post Bash (or other shell) only scripts.

I will usually do what Peter said first and then if I don’t find what I need I’ll try the other.

-ccs

1 Like

I've had a macro set that utilizes lpstat to change printers based on my network SSID (essentially my location). One printer for home, another for work, and PDF for elsewhere. Very useful!

3 Likes

thank you @peternlewis @ccstone

Would you have any idea if there would be a way to select both the printer and the printer preset ?

I find that the most tedious part of printing is selecting the preset each time from a drop down list.