Using LibreOffice with Terminal


I’m trying to convert a .docx file to a .txt file using Terminal and LibreOffice. However, I can’t seem to get the soffice command to work. What are the steps I need to take to get soffice to work on MacOS with Terminal? I’m trying to run this command: soffice --headless --convert-to txt…but I get -bash soffice: command not found. I’m going crazy trying to get the command line tools to work with LibreOffice. :frowning:


And what if you simply type soffice? Does LibreOffice start? If not, try to write the full path to the executable (if, of course, it is possible in MacOS).

According to a recent post of @anon73440385 the command on unixoid systems like MacOS is something like libreoffice6.3 instead of soffice. So it depends on the installed version.

@Cookievore in my openSUSE Leap box, libreoffice starts LibreOffice 6.3 without problems. Maybe it’s a bad packaging on a particular distribution?

I would prefer LibreOffice should leave the terminal once the LibreOffice opens. This would clarify my thoughts command line - How to cleanly launch a GUI app via the Terminal? - Ask Ubuntu

Using /Applications/ worked for me, though it spit a few benign graphic init errors, it generated my output sheet fine (version

/Applications/ --headless --convert-to csv foo.xls[x]

Docs say batch convert implies headless, so can drop that param.

With macOS you have to point to the binary in the app bundle…

/Applications/ --[options] [filename]


thanks, was poking around the packages looking for proper command code. it was so wild to see a full python 3.x instance and sources in there. run w --help or -h or -? to get full list of options, shows my version as LibreOffice