Development/BuildingOnMac

    From The Document Foundation Wiki

    This page describes how to set up a build environment for LibreOffice on macOS 10.14.4. Building master requires Xcode 11.3 or later, which requires macOS 10.14.4 or later.

    Prerequisites

    1. Install Xcode from the App Store. The intent is that LibreOffice will always be buildable with the current Xcode on current macOS. Right after a new Xcode version is released, or after a new macOS version is released, there might be a few days while that is not true. Just be patient in that case. Using older Xcode versions on older macOS versions might also work. What you are absolutely not expected to do is to specifically download some old Xcode version or a separate old SDK and use those.
    2. Run Xcode at least once (you don't need to open or create any project)
    3. Check from Xcode ▸ Settings ▸ Locations that the Command Line Tools entry is not empty
    4. If you are planning to work on the parts of LibreOffice that are implemented in Java, mainly the HSQLDB embedded database in Base, you need to download and install a JDK (Java SE Development Kit): Oracle's Java SE Development Kit. But that is entirely optional. If you want to avoid Java, just use the --without-java option in your autogen.input or on the autogen.sh command line, when you get that far.

    Notice: according to https://lists.freedesktop.org/archives/libreoffice/2021-April/087205.html, everything should be ok to build with mac containing processor Apple Silicon M1 except a known issue with in-process JVM (see https://lists.freedesktop.org/archives/libreoffice/2020-December/086490.html)

    Building

    It is recommended that you use Development/lode for setup and configuration.

    If you don't use Lode you will need to install dependencies as needed (e.g. brew install autoconf automake libtool). You will also need to configure the relevant flags in autogen.input to make building possible.

    Building Tips

    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.

    Performance

    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

    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 code between 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: [1]

    Build it like this:

    ./configure
    make
    make install

    You will also need to ensure the following is defined, e.g. in .bash_profile in your home folder, if using ccache (see Development/Building LibreOffice with Clang for full details), otherwise clang will report errors and show unnecessary warnings:

    export CCACHE_CPP2=YES

    The default cache limit (5 GB) is not large enough to be useful for a LibreOffice build, but you can increase it, for instance to 30 GB:

    ccache --max-size 30 G

    To check what the current cache limit is, and see ccache statistics, run it with the -s command-line option:

    ccache -s


    Upgrading to a recent macOS on unsupported machines

    Using various unofficial third-party tools it might be possible to run newer macOS versions on machines that are older than what that macOS version supports. If you need that, search for it. It is not relevant to duplicate such information here.

    See also