If you are installing the library directly from the sources, the recommended way to do so is by using GNU Autotools.

To install the library, just use the standard procedure:

./configure --prefix=PATH/TO/LIBXC
make check
make install

Do not forget to replace PATH/TO/LIBXC by the some appropriate path on your file system and make sure that you have write permissions.

If you obtained the sources directly from the git repository, you will first need to generate configure by running

autoreconf -i


Support for building the sources using CMake has also been recently contributed by Lori Burns.

The CMake file has the following caveats

Building with CMake

Use the following procedure:

cmake -H. -Bobjdir
cd objdir && make
make test
make install

The build is also responsive to

See CMakeLists.txt for options details. All these build options should be passed as cmake -DOPTION.

Detecting with CMake

CMake builds install with LibxcConfig.cmake, LibxcConfigVersion.cmake, and LibxcTargets.cmake files suitable for use with CMake find_package() in CONFIG mode.

See cmake/ for details of how to detect the Config file and what CMake variables and targets are exported to your project.

Use with CMake

After find_package(Libxc ...),

Python Library

Optional Python bindings are available through the cytpes module. To install into Python site-packages plese run:

python install

or, to install locally for development:

python develop

The Python bindings require the CMake compilation pathway and the Python Numerical Python library. A short usage example is provided below:

# Build functional
>>> func = pylibxc.LibXCFunctional("gga_c_pbe", "unpolarized")

# Create input
>>> inp = {}
>>> inp["rho"] = np.random.random((3))
>>> inp["sigma"] = np.random.random((3))

# Compute
>>> ret = func.compute(inp)
>>> for k, v in ret.items():
>>>     print(k, v)

zk [[-0.06782171 -0.05452743 -0.04663709]]
vrho [[-0.08349967 -0.0824188  -0.08054892]]
vsigma [[ 0.00381277  0.00899967  0.01460601]]


Libxc is now available in Fedora. To compile against Libxc one just needs to install the development package with

 $ dnf -y install libxc-devel

If the Libxc Fortran module file is needed, one needs to add ‘-I/usr/lib64/gfortran/modules’ or ‘-I/usr/lib/gfortran/modules’ (on 32-bit systems) to the compiler arguments.


Libxc was added to this Ubuntu repository for easier installation. To add this repository to Ubuntu, all one has to do is type-in:

 $ sudo add-apt-repository ppa:hogliux/misstep

Now Libxc can be installed via the Ubuntu software centre and will receive automatic updates.


Libxc for Mac OSX is available from the Homebrew package manager. After Homebrew installation one types in:

$ brew install gfortran
$ brew install libxc


Libxc was also added to the macports repository for easier installation on Mac OS X. After installing macports the user can type in:

$ sudo port selfupdate
$ sudo port install libxc

Again the user will receive automatic updates. Note: installation time takes very long because gfortran needs to be built first.