Building/installing the code

Grab the code:

tar xjf

Build it. The short version:

make py
make extra
make install  # to put it in /usr/local/astrometry
# or:
make install INSTALL_DIR=/some/other/place

The long version:


For full functionality, you will need:

Ubuntu or Debian-like systems:

$ sudo apt-get install libcairo2-dev libnetpbm10-dev netpbm \
                       libpng12-dev libjpeg-dev python-numpy \
                       python-pyfits python-dev zlib1g-dev \
                       libbz2-dev swig cfitsio-dev

For example, in Debian 9 (Stretch):

$ sudo apt-get install libcairo2-dev libnetpbm10-dev netpbm \
                       libpng-dev libjpeg-dev python-numpy \
                       python-pyfits python-dev zlib1g-dev \
                       libbz2-dev swig libcfitsio-dev

CentOS 6.5 / Fedora / RedHat / RHEL – Detailed Instructions:

See these instructions from James Chamberlain.

Arch Linux

A package can be installed from the Arch Linux (AUR).

Mac OS X using homebrew:

These instructions Worked For Me as of September 2012 on OSX 10.8.

First set up homebrew:

Get homebrew dependencies that need special instructions:

$ brew install --HEAD --use-gcc netpbm

Optionally, grab some other handy homebrew packages:

$ brew install cfitsio --with-examples
$ brew install md5sha1sum     # OSX doesn't come with this?!  For shame

Get our fork of homebrew-science and install:

$ brew tap homebrew/homebrew-science
$ brew install astrometry-net


$ brew install --HEAD

if you like to live dangerously (but trendily).

Mac OS X using Fink:

Use apt-get install as per the Debian instructions above (leaving out zlib1g-dev because it’s already included with OSX). Note that to use Fink you will need to add something like this in your ~/.profile or ~/.bashrc file:

. /sw/bin/
export CFLAGS="-I/usr/local/include -I/sw/include"
export LDFLAGS="-L/usr/local/lib -L/sw/lib"


If you don’t have and can’t get these libraries, you should still be able to compile and use the core parts of the solver, but you will miss out on some eye-candy.

Build the solving system:

$ make

If you installed the libraries listed above, build the plotting code:

$ make extra

Install it:

$ make install

You might see some error message during compilation; see the section ERROR MESSAGES below for fixes to common problems.

By default it will be installed in /usr/local/astrometry . You can override this by either:

  • editing the top-level Makefile (look for INSTALL_DIR); or

  • defining INSTALL_DIR on the command-line:

    For bash shell:

    $ export INSTALL_DIR=/path/to/astrometry
    $ make install


    $ INSTALL_DIR=/path/to/astrometry make install

    For tcsh shell:

    $ setenv INSTALL_DIR /path/to/astrometry
    $ make install

The astrometry solver is composed of several executables. You may want to add the INSTALL_DIR/bin directory to your path:

For bash shell:

$ export PATH="$PATH:/usr/local/astrometry/bin"

For tcsh shell:

$ setenv PATH "$PATH:/usr/local/astrometry/bin"

Some of the scripts are written in Python and are run using the python from the user’s environment via env python. To override this and use a python executable of your choice, you can use the PYTHON_SCRIPT variable, eg,:

$ make install INSTALL_DIR=/your/install/directory PYTHON_SCRIPT="/usr/bin/env python3.6"'


$ make install INSTALL_DIR=/your/install/directory PYTHON_SCRIPT="/usr/local/bin/python3.6"'


We use a do-it-yourself auto-config system that tries to detect what is available on your machine. It is called os-features, and it works by trying to compile, link, and run a number of executables to detect:

  • whether the “netpbm” library is available
  • whether certain GNU-specific function calls exist

You can change the flags used to compile and link “netpbm” by either:

  • editing util/makefile.netpbm

  • setting NETPBM_INC or NETPBM_LIB, like this:

    $ make NETPBM_INC="-I/tmp" NETPBM_LIB="-L/tmp -lnetpbm"

You can see whether netpbm was successfully detected by:

$ cat util/makefile.os-features
# This file is generated by util/Makefile.

You can force a re-detection either by deleting util/makefile.os-features and util/os-features-config.h, or running:

$ make reconfig

(which just deletes those files)

Overriding Things

For most of the libraries we use, there is a file called util/makefile.* where we try to auto-configure where the headers and libraries can be found. We use pkg-config when possible, but you can override things.

*_INC are the compile flags (eg, for the include files).

*_LIB is for libraries.

*_SLIB, when used, is for static libraries (.a files).


You can either use your system’s GSL (GNU scientific library) libraries, or the subset we ship. (You don’t need to do anything special to use the shipped version.)


make SYSTEM_GSL=yes

Or specify static lib:

make SYSTEM_GSL=yes GSL_INC="-I/to/gsl/include" GSL_SLIB="/to/gsl/lib/libgsl.a"

Or specify dynamic lib:

make SYSTEM_GSL=yes GSL_INC="-I/to/gsl/include" GSL_LIB="-L/to/gsl/lib -lgsl"


For dynamic libs:

make CFITS_INC="-I/to/cfitsio/include" CFITS_LIB="-L/to/cfitsio/lib -lcfitsio"

Or for static lib:

make CFITS_INC="-I/to/cfitsio" CFITS_SLIB="/to/cfitsio/lib/libcfitsio.a"


make NETPBM_INC="-I/to/netpbm" NETPBM_LIB="-L/to/netpbm/lib -lnetpbm"