Skip to content
C library for the MaxMind DB file format
C Perl M4 Shell Makefile
Branch: master
Clone or download

Latest commit

Latest commit 0cb758d May 12, 2020


Type Name Latest commit message Commit time
Failed to load latest commit information.
bin Display prefix length for record in mmdblookup Sep 15, 2019
dev-bin Correctly generate man page links Nov 1, 2019
doc Use correct prefix. Closes #229 May 12, 2020
include Bumped version to 1.4.2 Nov 2, 2019
projects Add src to win32 project include directories Aug 21, 2019
src Don't force wide string on possibly `CreateFileA`. Apr 27, 2020
t Fix MinGW cross compilation Oct 19, 2019
.gitignore Allocate memory for multiple MMDB_entry_data_list structs up front Nov 1, 2017
.gitmodules use https submodule urls Mar 31, 2017
.perltidyrc Add .perltidyrc file May 19, 2014
.travis.yml Ignore unused-function warnings Aug 21, 2019
.uncrustify.cfg A few more uncrustify tweaks Sep 12, 2013
AUTHORS Create geoip2-api-c repo with autotools Dec 31, 2012 Mention #228 in changelog May 1, 2020
LICENSE Add the full license text back in LICENSE Feb 20, 2014 Do not include all of t/ in dist May 21, 2018
NOTICE Rename COPYRIGHT to NOTICE Feb 20, 2014 Add some more info to about releasing Nov 10, 2017 Remove script to regenerate prototypes Jan 25, 2019
appveyor.yml Add VS project file for metadata pointer test May 12, 2017
bootstrap Only try to remove if it exists Feb 24, 2014 Use a slightly less gross method of ensuring we get c99, not gnu99 Oct 9, 2013 Bumped version to 1.4.2 Nov 2, 2019


The libmaxminddb library provides a C library for reading MaxMind DB files, including the GeoIP2 databases from MaxMind. This is a custom binary format designed to facilitate fast lookups of IP addresses while allowing for great flexibility in the type of data associated with an address.

The MaxMind DB format is an open format. The spec is available at This spec is licensed under the Creative Commons Attribution-ShareAlike 3.0 Unported License.

See for more details about MaxMind's GeoIP2 products.


This library is licensed under the Apache License, Version 2.


From a Named Release Tarball

NOTE: These instructions are for installation from the named .tar.gz tarballs on the Releases page (e.g. libmaxminddb-*.tar.gz).

This code is known to work with GCC 4.4+ and clang 3.2+. It should also work on other compilers that supports C99, POSIX.1-2001, and the -fms-extensions flag (or equivalent). The latter is needed to allow an anonymous union in a structure.

To install this code, run the following commands:

$ ./configure
$ make
$ make check
$ sudo make install
$ sudo ldconfig

You can skip the make check step but it's always good to know that tests are passing on your platform.

The configure script takes the standard options to set where files are installed such as --prefix, etc. See ./configure --help for details.

If after installing, you receive an error that is missing you may need to add the lib directory in your prefix to your library path. On most Linux distributions when using the default prefix (/usr/local), you can do this by running the following commands:

$ sudo sh -c "echo /usr/local/lib  >> /etc/"
$ ldconfig

From a GitHub "Source Code" Archive / Git Repo Clone (Achtung!)

NOTE: These instructions are for installation from the GitHub "Source Code" archives also available on the Releases page (e.g. or X.Y.Z.tar.gz), as well as installation directly from a clone of the Git repo. Installation from these sources are possible but will present challenges to users not comfortable with manual dependency resolution.

You will need automake, autoconf, and libtool installed in addition to make and a compiler.

You can clone this repository and build it by running:

$ git clone --recursive

After cloning, run ./bootstrap from the libmaxminddb directory and then follow the instructions for installing from a named release tarball as described above.

On Windows via Visual Studio 2013+

We provide a Visual Studio solution in projects\VS12. This can be used to build both the the library and the tests. Please see the file in the same directory for more information.

On Ubuntu via PPA

MaxMind provides a PPA for recent version of Ubuntu. To add the PPA to your APT sources, run:

$ sudo add-apt-repository ppa:maxmind/ppa

Then install the packages by running:

$ sudo apt update
$ sudo apt install libmaxminddb0 libmaxminddb-dev mmdb-bin

On OS X via Homebrew

If you are on OS X and you have homebrew (see you can install libmaxminddb via brew.

$ brew install libmaxminddb

Bug Reports

Please report bugs by filing an issue with our GitHub issue tracker at

Dev Tools

We have a few development tools under the dev-bin directory to make development easier. These are written in Perl or shell. They are:

  • - This runs uncrustify on all the code. Please run this before submitting patches.
  • - This runs Valgrind on the tests and mmdblookup to check for memory leaks.

Creating a Release Tarball

Use make safedist to check the resulting tarball.

Copyright and License

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

You can’t perform that action at this time.