You can install LibreOffice from a command line, but the exact command depends on your operating system and package manager. On Debian or Ubuntu, for example, run sudo apt update && sudo apt install libreoffice; Windows and macOS users can use tools such as winget and Homebrew, or install an official installer from the command line.
What a command-line install does
A command-line installation tells your operating system or package manager to download and install LibreOffice without navigating through a graphical app store. It does not mean LibreOffice itself must run without a graphical interface. After installation, Writer, Calc, Impress, and the other included applications can be opened normally from the desktop.
There are two related tasks people often mean by “LibreOffice command line.” One is installing the suite with a terminal command. The other is using LibreOffice’s own command-line program, commonly called soffice, to convert or process documents. You need to install the software first, but you do not need to use the terminal for everyday editing.
Commands below assume that the package manager is already available and that you have permission to install software. On Linux, that usually means using sudo for a system-wide installation. On a managed work or school computer, an administrator may need to approve or perform the installation.
Install LibreOffice on Linux
For most Linux users, the simplest approach is the distribution’s own package manager. This keeps LibreOffice integrated with system updates and dependencies. Package names and available versions can vary by distribution, so use the command for your system rather than copying one at random.
- Debian or Ubuntu:
sudo apt update && sudo apt install libreoffice - Fedora:
sudo dnf install libreoffice - Arch Linux:
sudo pacman -S libreoffice-fresh - openSUSE:
sudo zypper install libreoffice
On Debian-based systems, apt update refreshes the local package index; it does not upgrade every installed application. The second command installs the LibreOffice package and the components it depends on. Fedora, Arch, and openSUSE use different package tools, but the general idea is similar: the package manager resolves dependencies and obtains software from configured repositories.
Distribution repositories may not offer the newest upstream release immediately. That is often a reasonable trade-off: packages are tested and maintained according to the distribution’s release policy. If you need a particular version, check the official LibreOffice download page and your distribution’s documentation before mixing packages from different sources. Replacing system packages with unrelated downloads can complicate future updates.
Install it on Windows from a terminal
If Windows Package Manager (winget) is installed, first search for LibreOffice so you can confirm the package offered by your configured source:
winget search LibreOffice
The usual package ID is TheDocumentFoundation.LibreOffice. You can install that exact listing with:
winget install --id TheDocumentFoundation.LibreOffice --exact
Winget may display prompts or ask you to accept source or package agreements, depending on your setup and its version. If the search results do not show that ID, use the ID displayed by your search instead of guessing. A work-managed PC may also restrict winget or require an administrator to approve installations.
Another option is to download the official Windows MSI installer and invoke Windows Installer from Command Prompt or PowerShell. With the MSI file in the current directory, a quiet system installation can be started with:
msiexec /i LibreOffice_x.x.x_Win_x86-64.msi /qn /norestart
Replace the example filename with the actual downloaded filename; its version and architecture will differ. The /qn option requests no user interface, so it is useful for deployment but gives little visible feedback. Administrators distributing software to many PCs should test the selected MSI and installation options in their environment before broad deployment.
Install it on macOS from a terminal
On a Mac with Homebrew already installed, use its cask for the desktop application:
brew install --cask libreoffice
Homebrew downloads and installs the application bundle. If the command reports that Homebrew is missing, install Homebrew only from its official instructions, or use LibreOffice’s official macOS download instead. The normal macOS installer is a disk image containing the application; downloading it does not automatically make the soffice command available in every shell’s PATH.
Homebrew is convenient for people who already manage Mac applications that way, while the official download is straightforward for users who prefer the standard macOS installation flow. On either route, macOS security settings may require you to confirm the first launch. If a Mac is controlled by an organization, its software policies can affect both installation and first-run approval.
Choose the right installation source
For a personal computer, the best source is usually the one that fits how you already update applications. A system package manager offers a familiar upgrade path on Linux; winget provides a Windows command-line option; and Homebrew suits Mac users who already use it. The official LibreOffice site is useful when you need a direct installer or want to check the current release information.
- Prefer simplicity: use the operating system’s normal package manager or installer.
- Need managed deployment: use an installer format and documented options that your organization can test and maintain.
- Need a specific release: compare the official download with the version in your distribution repository, and plan how it will be updated.
- Want isolation: consider a supported sandboxed package such as Flatpak, while accounting for its permissions and file access behavior.
On Linux systems with Flatpak and the Flathub remote configured, the LibreOffice application ID is org.libreoffice.LibreOffice. A typical command is flatpak install flathub org.libreoffice.LibreOffice. Flatpak can keep an application separate from many host libraries, but it is not automatically the best choice for every machine: access to files, desktop integration, and update management differ from a native package. Check that Flathub is configured before treating a failed install as a LibreOffice problem.
LibreOffice is free to download and use; there is no purchase required to run these installation commands. A package manager may use network data, and a managed organization may have its own support or deployment costs, but those are separate from a LibreOffice license fee.
Check the installation and use the command-line tools
After installation on Linux or Windows, open a new terminal and try soffice --version. Some systems also provide a libreoffice command, but soffice is the common executable name used in command-line examples. If the shell says the command is not found, the application may still be installed; its executable may not be on your PATH, or the terminal may need to be reopened.
One practical use of the command-line program is converting a document to PDF. For example, from a directory containing report.docx, this command writes a PDF into a directory named converted:
soffice --headless --convert-to pdf --outdir converted report.docx
Create the destination directory first if it does not exist. The --headless option runs without opening the normal graphical interface, which is useful for scripts and remote sessions. Conversion results can depend on fonts, document features, and the source file, so check important output rather than assuming that every layout will be identical to Microsoft Office.
On macOS, the application bundle may be installed without placing its command-line executable on the default PATH. If soffice is not recognized, first verify that LibreOffice opens from Applications. You can then use the executable inside the application bundle or configure a suitable PATH entry according to your shell and installation method. Avoid making global shell changes unless you understand how they affect other users and programs.
Common installation problems and safe fixes
A “package not found” message usually points to a repository or package-name issue, not a need to try random download sites. Refresh the package index where appropriate, confirm that the correct repository is enabled, and check the package name for your distribution. On Windows, run winget search LibreOffice and use the exact listing available to your configured source. On macOS, check that Homebrew is installed and can update its metadata.
If installation succeeds but the command is unavailable, distinguish between the desktop application and the command-line executable. Try opening the app from the application menu, then check the executable location and PATH. A shell opened before installation may also have stale environment information, so opening a fresh terminal is a useful first test.
Use trusted sources: your distribution’s repositories, the official LibreOffice site, or a package manager you intentionally installed. Avoid commands from unfamiliar websites that pipe a downloaded script directly into a privileged shell. For unattended deployments, quiet mode can hide errors from a person at the screen, so capture installer logs or use your organization’s standard software-management tools. Do not run two headless LibreOffice jobs against the same user profile at once; profile locking can cause one process to fail or interfere with the other.
Frequently Asked Questions
What is the Linux command to install LibreOffice?
On Debian or Ubuntu, run sudo apt update && sudo apt install libreoffice. Fedora uses sudo dnf install libreoffice, while package names and commands can differ on other distributions.
Can I install LibreOffice on Windows using CMD?
Yes. If winget is available, search with winget search LibreOffice and install the matching package ID. You can also run the official MSI through msiexec; use quiet options only when you want an unattended installation.
Does LibreOffice have a command-line version?
LibreOffice includes the soffice command-line program. It can launch the suite and perform tasks such as headless document conversion, but it is part of the installed application rather than a separate office suite.
How do I install LibreOffice on a Mac with Homebrew?
Run brew install --cask libreoffice after installing Homebrew. The application can be present even if the soffice command is not on your shell’s PATH.
Is LibreOffice free to install?
Yes. LibreOffice is free software, and the commands above do not require a paid license. You may still have ordinary network, administration, or organizational support requirements.