Installation Details


This document provides additional details about installation that may help you solve certain difficulties, especially on Windows or Mac platforms.

The source code for this vignette is available at If you find something unclear or notice a typo, I would be very happy if you would click on the Pencil Icon on that page or follow this link to edit and suggest an alternative wording. Don't be shy about doing this; I have to review any change and even if your suggestion is not perfect it will still be a prompt for me to improve this document. Thank you!


nat is an R package and therefore runs on Mac/Linux/Windows. The only pre-requisite for most functionality is a recent version of R (>=3.1.0 recommended).

3D visualisation is provided by the rgl package based on OpenGL. On Mac OS X if you use RStudio or R from the terminal, you must have a copy of XQuartz, the X11 window manager, installed. This is no longer a default install since Mac OS X 10.8. You need to install XQuartz, before installing the nat package. Logout and login for the installation to take effect. You can get it from This page is also linked from the Download R for (Mac) OS X page.

If you want to apply non-rigid registrations calculated by the Computational Morphometry Toolkit (CMTK) you will need to install that separately – see section External Dependencies below.

Basic Installation

As of v1.0 there is a released version on CRAN. This is normally updated only every few months.


If you wish to run the package tests, it is necessary to install with all dependencies:

install.packages("nat", dependencies=TRUE)

Development version

nat remains under quite active development, so we generally suggest using the development version directly from github. The recommended way to do this is to install Hadley Wickham's invaluable devtools package (if you have not already done so) and then use that to install nat.

# install devtools if required
if (!require("devtools")) install.packages("devtools")
# then install nat

The nat package includes extensive unit tests which are run along with R's (extremely fastidious) package check routines by the [GitHub Actions( continuous integration server. The master branch is therefore considered very stable and may well contain fixes or enhancements over released versions. However, you can install any release version including the latest release as follows:


The same syntax can be used to install any arbitrary version that you want from github. See ?install_github for details.

Note: Windows users need Rtools to install in this way, but devtools should offer to install this for you if you do not already have it.

External Dependencies

nat is self sufficient for core functionality, but the transformation of 3D data using Computational Morphometry Toolkit (CMTK) registrations depends on an external installation of that toolkit. CMTK binaries can be downloaded for Windows, Linux and Mac at Source code is available from the same site or an unofficial mirror repository at We have extensive experience of using CMTK under Linux (where we compile from source) and Mac (where we compile or use the MacOSX-10.6-x86_64.dmg binary installers). We have also used neurodebian to install as part of our (now retired) Travis continuous integration setup (see the project's .travis.yml file).

CMTK+nat on Windows

We have much less experience using CMTK on Windows than on Mac/Linux platforms. Experiments in May 2016 suggest that the best option is to use the cygwin CMTK distribution (cygwin provides a linux like environment). Here are the steps we took:

Try the nat package in your browser

Any scripts or data that you put into this service are public.

nat documentation built on May 29, 2024, 10:36 a.m.