If R is already installed on your computer, then ape has to be installed like any other package. Some functions in ape require some other packages: nlme, lattice, expm, and gee. Only the two last ones will probably need to be installed since the others are included with most distributions of R.

If you have to install R, all required information can be found on the CRAN website. This is summarized here for the most common operating systems. There is also a section on how to update the packages.


Most Linux distributions offer a pre-compiled version of R on their sites. If so, then the easiest way is to install R like your other applications. You have to install "r-base" and "r-recommended" (which includes nlme and lattice).

If no pre-compiled R is available, then refer to the Unix section below.

Once R is installed, download the sources of ape from HERE, and run the following command as root:

R CMD INSTALL ape_4.1.tar.gz

If expm and gee are not installed, you have to do the same procedure with these packages.

If you use R version 2.14.0 or above, I recommend to install ape with byte-compile for a substantial increase in performance:

R CMD INSTALL --byte-compile ape_4.1.tar.gz

Note: Fedora users should install the RPM R-devel.I386 (or the appropriate version depending on the processor, e.g., R-devel.x86_64) to be able to compile R packages from sources (thanks to Timothée Flutre for this info).

ape is available on Debian:


R must be installed from the sources available on the main page of CRAN. This allows considerable tuning in the configuration: further information can be found in the "Installation and administration" manual. Roughly, the installation goes along the following lines:
  1. Download the R sources;
  2. Unzip and untar the sources;
  3. Enter the R directory and run ./configure;
  4. Run make;
  5. For a full install on your system, run as root make install.

Once R is installed, refer to the Linux section above for the installation of ape (and possibly expm and gee).


R for Macintosh can be downloaded HERE.

The GUI has a menu from where to install packages.

If you want to install ape from the sources, please read the instructions on the `R for Mac OS X FAQ', section 5.3:

Then type in R:

install.packages("ape", type = "source")


R for Windows can be downloaded HERE.

Once R is installed, start R by clicking the short-cut on the desktop. Choose the menu "Packages", then select "Install the package(s)...": a dialog box opens up to choose the mirror site where to download. A second box then opens up where you select the packages you want to install: select ape, this will also install expm and gee automatically.

Updating (all OSs)

Since you may end with many R packages on your computer, it is highly recommended to update them regularly. Whatever your operating system is, you can simply type the following command in R:


(This can be done from a menu under Windows and MacOS.) This function checks the version of each package installed on your computer against the one available on CRAN: if the latter is more recent, R proposes you to update it (your machine must obviously be connected on the internet).

Another way is to first check and download the available updates with:

o <- old.packages()

'o' is a matrix of character strings with the information on the updates available on CRAN. You may download the versions you want with, for instance (the second argument "." indicates to save the downloaded packages in the working directory):

download.packages("ape", ".")

To download all of them:

download.packages(o[, 1], ".")

The downloaded packages are then installed in the way described above. (I prefer this second method for security reasons since the download is not done as root.)

Stable and Testing Versions

ape is available in two versions: the stable version is distributed on CRAN and the testing version is distributed on the present site.

The stable version is numbered x.y or x.y-z. There is no fixed schedule for a new release though they usually happen every two to four months. The testing version is numbered x.y-z.t where the part before .t is the current version on CRAN.

The testing version includes new features that will be included in the future version on CRAN. It is mainly directed to maintainers of packages depending on ape, though it can be used by those who are curious about new features.

To check whether a testing version is available you may type in R:

old.packages(repos = "")

Testing versions are also available for pegas and coalescentMCMC. A package may be downloaded with:

download.packages("ape", ".", repos = "")

Two (or more) packages can be downloaded at the same time:

download.packages(c("ape", "pegas"), ".", repos = "")

The package(s) can then be installed in the way described above.

Windows builts are available thanks to Uwe Ligges's win-builder site. The available versions can be checked from any OS with:

old.packages(repos = "", type = "win.binary")

The option 'type' can be omitted under Windows. David Bapst pointed out that the following command is needed to install directly under Windows:

install.packages("ape", contriburl = "")

If you have installed a testing version, you can check whether the next stable version is available on CRAN with:


or whether a new testing version is available by setting 'repos' as above.

Updated: February 24, 2016
Crédits | Legal notice