Building LibreOffice on macOS
This page describes how to set up a build environment for LibreOffice on macOS 10.13 and 10.14. Building master requires Xcode 9.3 or later, which requires macOS 10.13.2 or later.
- Install Xcode. The latest version of Xcode is available as a free purchase in the Mac App Store. Previous and development versions of Xcode can be downloaded from developer.apple.com.
NOTE: If you try to build LibreOffice on macOS Mojave 10.14, please use Xcode 9.4.1, otherwise, LibreOffice will become really unstable due to a problem with Xcode 10 ( tdf#121778 ).
NOTE: according to anecdotal evidence, if we want to bump the build baseline to Xcode 10.x, we have to bump macOS to 10.14 as well.
- Download the 9.4.1 .xip file from here
- Unpack to Xcode.app
- Rename it to Xcode-9.4.1.app
- Run: sudo xcode-select --switch ~/Downloads/Xcode-9.4.1.app/Contents/Developer ( To switch back the the normal Xcode, run: sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer )
- Select the Xcode's active developer directory:
sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer
- You need to first accept the Xcode EULA by either launching Xcode or running the following command:
sudo xcodebuild -license
- Install Apple's Command Line Developer Tools by running the following command:
sudo xcode-select --install
- Download and install a JDK (Java SE Development Kit):
- Oracle's Java SE Development Kit 8 requires an Intel-based computer running macOS 10.8, or later.
If you don't want to install Java JDK, add
From your home directory (or anywhere else you want really) as a regular user:
$ git clone git://gerrit.libreoffice.org/lode $ cd lode $ ./setup --dev --force
Follow the messages at the end of the last command: you need to add
$ export LODE_HOME=<path to the cloned lode repo>
export PATH=$LODE_HOME/opt/bin:$PATH to
Exit you session, start a shell again to pick up the changes in .profile. Check this is working using
echo $PATH. then
$ cd lode/dev/core $ ./autogen.sh --disable-cve-tests $ make 2>&1 | tee build.log
To run LibreOffice run command:
$ open instdir/LibreOfficeDev.app
lode is developed by Infra to manage the deployment of CI slaves bots, it is used and maintained regularly.
See platform-independent tips at Development/GenericBuildingHints
Building in a ssh session
In some cases it seems that if you are building in a ssh session, some unit tests fail unless you also have a windowing session open to the machine, either on the physical console or through Screen Sharing.
Building LibreOffice takes time, a lot of time. Exactly how much depends on how powerful your machine is. But there are tools you can use to speed-up things.
ccache is short for compiler cache - and it is exactly that. It saves tons of time by not running the actual compiler when little has changed in the source codebetween two builds. But note that unless you explicitly do "make clean" often, that is not typically the case, and using ccache just because you think it maybe helps is not a good idea.
Get it here: 
Build it like this:
./configure make make install
You will also need to ensure the following is defined, e.g. in .bashrc, if using ccache (see Development/Building LibreOffice with Clang for full details), otherwise clang will report errors and show unnecessary warnings:
The default cache limit (5 GB) is not large enough to be useful for a LibreOffice build, but you can increase it:
ccache --max-size 16 G && ccache -s
Upgrading to a recent macOS on unsupported machines
With macOS High Sierra Patcher and macOS Mojave Patcher tools it is possible to install current macOSes on older, unsupported machines, see this video for details. Read Known issues on the tool's site, and try at your own risk.
Build the UNO SDK
One option is to install Doxygen from its website and make sure the
doxygen executable is found on the
PATH, or specify its exact location via
--with-doxygen=pathname configure switch.
Another option is to configure
--without-doxygen, in which case the HTML documentation for the C++ UNO interface will be missing from the UNO SDK being built.