Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 18 You must be signed in to star a gist
  • Fork 7 You must be signed in to fork a gist
  • Save pankaj28843/3ad78df6290b5ba931c1 to your computer and use it in GitHub Desktop.
Save pankaj28843/3ad78df6290b5ba931c1 to your computer and use it in GitHub Desktop.
Make soffice command of Libreoffice work on Mac OS X

Quick Start

sudo curl https://gist.githubusercontent.com/pankaj28843/3ad78df6290b5ba931c1/raw/soffice.sh > /usr/local/bin/soffice && sudo chmod +x /usr/local/bin/soffice

Create an bash script at /usr/local/bin/soffice with following content

#!/bin/bash

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

Make it executable

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

Usage

Convert an excel file to pdf

soffice --headless --convert-to pdf:"calc_pdf_Export" /path/to/some/.xlsx/file
#!/bin/bash
# Need to do this because symlink won't work
# It complains about some .plist files
/Applications/LibreOffice.app/Contents/MacOS/soffice "$@"
@rootelement
Copy link

Your paths are missing the L in local.

/usr/loca/bin/soffice

@kirtideshmukh
Copy link

Does this work in latest version ? Because I am not able to locate soffice script under Applications

@florianeck
Copy link

please change /usr/loca/ to /usr/local/ 😄

@dan-maximov
Copy link

Please, change psjinx to your new nickname

@osbre
Copy link

osbre commented Feb 21, 2022

Thanks for the tip, to simplify I just use

/Applications/LibreOffice.app/Contents/MacOS/soffice

@transducer
Copy link

brew install --cask libreoffice also creates a soffice binary.

@FaradayLight
Copy link

Why go to all this trouble when you can create a symlink from a local bin folder in your PATH?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment