How to convert documents to PDF on OSX

I have seen posts on how to batch convert various documents to PDF via command line for both windows and linux. Now OSX being unix based I figure it must be similar to the linux posts but I have yet to figure out the correct syntax. Im using LibreOffice on OSX 10.6.8. I aslo have access to Acrobat Pro 9 on this machine if someone knows of a better way to do the batch conversion and can point me in the right direction with that. Thanks in advance!

how would you specify the output folder?


You can do the same using the Terminal in Mac OSX (tested using Mac OSX 10.8.2).

  • Open Terminal
  • cd to your LibreOffice installation like:
cd /Applications/
  • then you can run the same command as you used in Linux:
./soffice --headless --convert-to  

Example to convert all odt files to pdf in my Downloads folder:

./soffice --headless --convert-to pdf ~/Downloads/*.odt
  • To specify an output folder you can add the --outdir option

    For example:
 ./soffice --headless --convert-to pdf --outdir /home/user ~/Downloads/*.odt
  • For other options or help you can use:
./soffice --help

Kind regards,


I tried this with 10 files for test, succes.
But not works on the full folder (contains 4500 doc files)
Terminal said too many arguments

What is the limit?

Not working… Once in LibreOffice installation I used this syntax:
./soffice --headless --convert-to pdf --outdir ~/Desktop /Users/user/Desktop/*.doc

And returns this:
/Applications/–-headless does not exist.
/Applications/–-convert-to does not exist.
/Applications/ does not exist.
/Applications/—-outdir does not exist.

Using, on Mac OS X 10.10


Quick Start

sudo curl sudo curl > /usr/loca/bin/soffice && sudo chmod +x /usr/loca/bin/soffice

Create a shell script at /usr/loca/bin/soffice with following content


# Need to do this because symlink won't work
# It complains about some .plist files
/Applications/ "$@"

Make it executable

sudo chmod +x /usr/loca/bin/soffice


Now you can run soffice command from anywhere

Convert an excel file to pdf

soffice --headless --convert-to pdf:"calc_pdf_Export" /path/to/some/.xlsx/file

The exact solution I was looking for =D Thanks !

I tried but without result with this command shell
cmd="/Applications/ --headless --convert-to pdf /Users/lismax/Desktop/MioFile.rtf"

where I’m wrong ?

Please don’t post a question as an answer. Do post a new question giving as much relevant detail as possible. Do also feel free to link back to this Q&A. Then delete this “answer”! (Or a moderator might do that for you.) Thanks.