How do I print ZPL Labels from the Command Line on Mac/Unix?

It's much easier to automate printing of ZPL labels from the command line than through any UI. On Mac/Unix, you can print in just two steps:

  1. Find your ZPL printer's name in the list of attached printers:

    $ lpstat -p -d

  2. Use that printer's name and your ZPL's filename:

    $ lpr -P <PRINTER_NAME> -o raw <FILENAME.zpl>

Some printers require additional options, such as page size and margins. To get your printer's specific options, use:

$ lpoptions -p PRINTER_NAME -l.

The command might end up looking something like this depending on the options it lists:

$ lpr -P PRINTER_NAME -o media=Custom.4x6in -o page-left=0 -o page-right=0 -o page-top=0 -o page-bottom=0 FILENAME.png

Don't see your question? Talk to a shipping expert