Initial Query
I have a .ps file that I want to print from my mac. I'm trying to use lpr. But every time I print it all I get is the actual bytes just printed with like hundreds of pages and this is not what I want. I want the printer to just print the ps directly. What command should I use to make this work?
LLM Generation
Query
I have a .ps file that I want to print from my mac. I'm trying to use lpr. But every time I print it all I get is the actual bytes just printed with like hundreds of pages and this is not what I want. I want the printer to just print the ps directly. What command should I use to make this work?
Output
To print a PostScript (.ps) file correctly from your Mac, you need to ensure the printer or your system interprets the file properly. Here's how to fix this:
---
### **1. Check if Your Printer Supports PostScript**
Most consumer printers **do not natively support PostScript** (they require a PCL or PDF interpreter). If your printer isn't PostScript-capable, sending the raw `.ps` file will print the literal code (hence the gibberish). To verify:
- Check your printer specifications for "PostScript support".
- If it lacks PostScript support, **convert the `.ps` file to PDF first** (see Step 3).
---
### **2. Use `lpr` with Explicit Format (For PostScript Printers)**
If your printer **does** support PostScript, force the format with:
| lpr -o document-format=application/postscript yourfile.ps
|
This tells macOS to send the file as PostScript without conversion.
---
### **3. Convert to PDF (For Non-PostScript Printers)**
Convert the `.ps` file to PDF using **Ghostscript** (install via [Homebrew](https://brew.sh) if needed):
| brew install ghostscript # Install Ghostscript if missing
gs -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=output.pdf input.ps
|
Then print the PDF:
---
### **4. Use macOS Preview (Simpler Method)**
Open the `.ps` file in Preview, which will auto-convert it to a printable format:
| open -a Preview yourfile.ps
|
Then print via Preview’s GUI (⌘P).
---
### **5. Verify the PostScript File**
Test with a simple PostScript file to rule out file corruption. Create `test.ps`:
| %!PS
/Courier findfont 24 scalefont setfont
100 100 moveto (Hello World) show
showpage
|
Print it. If this works, your original `.ps` file might be malformed.
---
### **Advanced: Check CUPS Configuration**
Access the CUPS web interface to verify printer settings:
| cupsctl WebInterface=yes # Enable web interface
open http://localhost:631/printers
|
Check if your printer’s PPD file includes PostScript support.
---
### Summary
- **PostScript Printer?** Use `lpr -o document-format=application/postscript`.
- **Non-PostScript Printer?** Convert to PDF with Ghostscript first.
- **Quick Fix:** Open in Preview and print.
Check if any of the following conditions are true:
Substring Evaluation
Testing if the previous output contains the string -l
: False
Substring Evaluation
Testing if the previous output contains the string -o raw
: False
Final Answer: False