Building LibreOffice on OS X

From The Document Foundation Wiki
Jump to: navigation, search

This page describes how to set up a build environment for LibreOffice on OS X 10.8, 10.9, 10.10 and 10.11. When building LibreOffice on OS X 10.11, you currently need to use at least --disable-firebird-sdbc.

The Mac is, in a way, the easiest platform to build LibreOffice on, as you don't need to get tons of stuff.

Actually installing additional stuff not listed here might make compiling LibreOffice much more difficult. However, some people seem to disagree; see the "Minimal Setup with MacPorts for external dependencies" section.

There are three fundamentally different approaches to set up a build environment on OS X as described in the "Quick Pre-canned Setup", "Minimal Setup", and "Minimal Setup with MacPorts for external dependencies" sections below. Choose one of them; don't mix them up. "Minimal Setup" is the more traditional setup option; if you ask for advice on IRC it is more likely that people familiar with that way will be present and willing to help.

Quick Pre-canned Setup

see Development/lode

In a nutshell install Xcode and Java JDK (see below about tweak to the Java install that are needed on recent mac)

From your home directory (or anywhere else you want really) as a regular user:

git clone git://
cd lode
./setup --dev

Follow the messages at the end of the last command: you need to add export LODE_HOME=<path to the cloned lode repo> and export PATH=$LODE_HOME/opt/bin:$PATH to ~/.bash_login

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
make 2>&1 | tee build.log


lode is developed by Infra to manage the deployment of CI slaves bots, it is used and maintained regularly.

Minimal Setup

  1. Install Xcode (current version is 7.3) from the Mac App Store
  2. Run Xcode
    1. In Xcode's Preferences, select Locations and make sure the corresponding Command Line Tools are installed
  3. Open a Terminal
  4. Create a file
    with the following content:
    export PATH=/opt/lo/bin:$PATH
    export PATH=/opt/lo/bin:/sbin:$PATH
    if /sbin is not already in the PATH
  5. Create a file
    with the following content:
    source ~/.bashrc
  6. Exit the Terminal and open a new one.
  7. type
    echo $PATH
    and check that
    appears in the path. If it does not, then:
    1. Add the line
      source ~/.bashrc
      to a file called ~/.bash_profile
    2. Exit the terminal and open a new one.
  8. Create a directory 'lo' and lo/packages
    mkdir -p ~/lo/packages
  9. Download, build and install autoconf
    cd ~/lo/packages

    curl -O

    tar xvzf autoconf-2.65.tar.gz

    cd autoconf-2.65

    ./configure --prefix=/opt/lo


    sudo make install
  10. Download, build and install automake
    cd ~/lo/packages

    curl -O

    tar xvzf automake-1.11.tar.gz

    cd automake-1.11

    ./configure --prefix=/opt/lo


    sudo make install
  11. Clone the git repository 'core'
    cd ~/lo

    git clone git://
  12. Build LibreOffice
    cd ~/lo/core


    make 2>&1 | tee build.log

If configure ( gives you an error along the lines of "GCC is too old, must be at least GCC 4.1.0" and you have an up to date XCode, it is possible that you might need to first accept the XCode user agreement. This can be prompted by running e.g. 'xcrun -find clang' as root, or possibly by trying gcc or starting XCode directly. Once this is done configure should succeed.

If during the phase you see a pop-up asking you if you want to install a Java JRE, say yes and once the JRE is installed, re-run

Minimal Setup with MacPorts for external dependencies

  1. 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
  2. Select the Xcode's active developer directory:
    Xcode 6:
    sudo xcode-select -switch /Applications/
    Xcode 7:
    sudo xcode-select -switch /Applications/
  3. You need to first accept the Xcode EULA by either launching Xcode or running the following command:
    sudo xcodebuild -license
  4. Install Apple's Command Line Developer Tools by either Downloading from or running the following command:
    sudo xcode-select --install
  5. Download and install a JDK (Java SE Development Kit):

Edit /Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Info.plist and change:



  1. Download and install MacPorts. If you wish to install multiple copies of MacPorts you must install MacPorts from the source code, otherwise install MacPorts using the Mac OS X package installer and skip the following steeps:
    1. Download the compressed tarball with MacPorts sources (i.e. MacPorts-2.3.2.tar.gz)
    2. Unpack the tarball
      tar xzvf MacPorts-2.3.2.tar.gz
    3. Enter into the sources folder:
      cd MacPorts-2.3.2
    4. Create the install location for MacPorts:
      sudo mkdir /opt/lo
    5. Configure, build & install MacPorts
      ./configure --prefix=/opt/lo --with-applications-dir=/Applications/MacPortsLO && make && sudo make install
    6. Edit ~/.profile file and add /opt/lo/bin & /opt/lo/sbin to the PATH variable. Example of ~/.profile:
      export PATH=/Applications/$PATH
      Load the changes in ~/.profile running the following command:
      source ~/.profile
  1. Update Ports tree, upgrade installed ports and uninstall inactive ports:
    sudo port selfupdate; sudo port -qsc upgrade outdated
    If there isn't any update, then you can skip the following command:
    sudo port uninstall inactive
  2. Install ant, automake, doxygen, maven and other tools with MacPorts:
    sudo port install -qsc apache-ant automake doxygen maven3 p5-archive-zip
    If you want to prevent the installation of X11 dependencies and to use XQuartz for native Mac OS X graphics. Download and install XQuartz, then run the following command instead of the previous:
    sudo port install -qsc apache-ant automake doxygen maven3 p5-archive-zip -x11 +quartz
  3. Download and install junit.jar:
    sudo mkdir -p /usr/share/java/; sudo curl -o /usr/share/java/junit.jar -O#L
  4. Clone the git repository 'core'
    mkdir -p ~/lo; cd ~/lo; git clone git://
  5. Build LibreOffice
    cd ~/lo/core; ./; time make

Building Tips

See platform-independant 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: [1]

Build it like this:

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 (1 GB) is not large enough to be useful for a LibreOffice build, but you can increase it:

ccache --max-size 16 G && ccache -s

Build the UNO SDK

As of the master, to build the UNO SDK (i.e., drop the --disable-odk configure switch), you need to have Doxygen installed so that HTML documentation for the C++ UNO interface can be generated.

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.

See also