Installation Instructions

Getting the Software

The libMesh source can be downloaded from our GitHub release page. Stable releases are located there as compressed tar archives. You may also access the Git source tree for the latest code. You can get read-only access to the Git repository via:
git clone git:// 

If you would like to contribute to the project you will need a GitHub developer account, or you can contribute patches. To create a patch from a modified Git tree simply do:
git diff > patch 

in the top-level directory. You can then submit the file patch.


libMesh makes extensive use of the standard C++ library and increasing use of C++11 standard language and library features, so you will need a recent, standards-compliant compiler. We have tried very hard to make the code compiler-agnostic by avoiding questionable constructs. If you have a C++11-supporting compiler that won't build libMesh code please let us know. You will also need a decent C compiler if you want to build some of the contributed packages that add functionality to the library.

libMesh Continuous Integration testing of all library modifications currently is done with gcc 6.2 and gcc 7.3. Less frequent testing is done with clang, Intel, and older gcc compilers.

External Software

libMesh has many features which are enabled via integration with various third-party libraries, a few of which are redistributed in our contrib directory, others of which may be separately installed on your system. The libMesh configure script attempts to autodetect these libraries when possible. Some of the supported libraries have occasionally changing (or even frequently changing) APIs. We attempt to provide a range of backwards compatibility for old versions of third-party APIs.


Configuring the library is straightforward. The GNU autoconf package is used to determine site-specific configuration parameters. A standard build will occur after typing

in the top-level project directory. To see all the configuration options type
./configure --help

The configure script will find your compilers and create Makefiles with the configuration specific for your site. If you want to use different compilers than those found by configure you can specify them in environment variables. For example, the following will build with the macports Clang compilers, and also specifies nonstandard search paths for a number of optional libraries:
./configure --prefix=/tmp/foo \
       --with-glpk-include=/opt/local/include \
       --with-glpk-lib=/opt/local/lib \
       --with-vtk-include=/opt/local/include/vtk-5.10 \
       --with-vtk-lib=/opt/local/lib/vtk-5.10 \
       --with-eigen-include=/opt/local/include/eigen3 \
       --with-cxx=clang++-mp-3.2 --with-cc=clang-mp-3.2 --disable-fortran

Note that the Fortran compiler is not actually used to compile any part of the library, but configure uses it to find out how to link Fortran libraries with C++ code, and it is possible to compile libMesh without a Fortran compiler.

Building the Library

To build the library you need GNU Make and a supported compiler, as listed in the Compiler section. After the library is configured simply type make to build the library.
The ./configure script distributed with the library looks at the shell environment variable METHODS to determine what modes the library should be built in. Valid values for METHOD are opt (optimized mode), dbg (build with debug symbols), and pro (build with profiling support for use with gprof). Once the library is configured you can build it simply by typing

Testing the Library

Running the Examples

libMesh includes a number of examples in the examples directory. From the top-level directory you can build and run the example programs by typing
make check

Note that many of the the example programs create output in the ExodusII format, since you can download Paraview for free, and it is a highly capable postprocessing tool. It is a simple matter to change the source in the example to write a different formats, however.

Unit Tests

The source tree contains a tests entry in the main trunk that contains a series of unit tests which can be used to validate a libMesh installation. These unit tests require CPPUnit to run properly. To run the unit test suite, from the build directory, simply do
make -C tests check 

Linking With Your Application

Since libMesh can be configured with many additional packages we recommend including the Make.common file created in the top-level directory in the Makefile of any application you want to use with the library. This will properly set the libmesh_INCLUDE and libmesh_LIBS variables, which you can append to with your own stuff.
For testing simple programs you may want to use the libmesh-config script included in the contrib/bin directory instead of creating a Makefile. This script may be used to determine the relevant compilation and linking flags used by libMesh. For example, you could build the application foo from foo.C like this:
 `libmesh-config --cxx` -o foo foo.C `libmesh-config --cxxflags --include --ldflags --libs`

Building on Windows

The libMesh library can be built on Microsoft Windows using the msys2 software distribution and the mingw-w64 compiler. There are, however, a few specifics that need to be taken into account.

After installing msys2 you need to install the mingw-w64 C++ compiler. To check that the installation was successfull, you can run

g++ --version

in the msys2 shell.

When you checkout the current version of libMesh using Git on Windows symlinks might not work. You can check whether your symlinks are set correctly by inspecting whether the README file points to the file. If this is not the case, you should run the contrib/bin/ from within the git repository using the msys2 shell. This script removes all symlinks and copies the symlink targets to the corresponding places.

Not all optional dependencies are available on Windows. It is known that the following packages do not compile on Windows.

Hence, these libraries need to be deactivated, using the corresponding flags. For example by configuring libMesh with the following command.

./configure --prefix=c:/libmesh \
    --disable-metis \

Then, the library can be built and installed using:

make install