Computer Software

Tutorials for Windows and Mac OS X/Linux/UNIX command line

The best way of running the programs listed below is by using the command line. Here, you have some links to command line tutorials on different operating systems:

BP&P: Bayesian analysis of genomic sequence data under the multispecies coalescent model

The BP&P program implements a series of Bayesian inference methods under the multispecies coalescent model with and without introgression. The analyses may include estimation of population size (theta’s) and species divergence times (tau’s), species tree estimation, species delimitation, and estimation of cross-species introgression intensity. We suggest that you get BP&P version 4 as it contains all the functionalities of version 3.4 but runs much faster and supports multiple threads. Also, the multispecies-coalescent-with-introgression (MSci) model is implemented in BP&P v4 only, and not in BP&P v3.4. The same control file works for both versions.

Downloads and installation for BP&P

The source code, installation guidelines, and tutorial for the latest version of BP&P can be found in the links below:

The source code and tutorial for the previous BP&P v3.4 is available in the links below:

If you have questions about either BP&P v3.4 or BP&P v4, please post them at the BP&P google group site here. Before posting a question, however, please use the search tool in the google groups site to make sure that other users have not already asked your query.

BP&P replaces the old program MCMCcoal, which implements the Bayesian method of Rannala & Yang (2003) and Burgess & Yang (2008).

Bruce Rannala has written a BPP GUI. The executables are for Windows and Mac OS X. You can use this to prepare the BP&P control files, and also read in the species trees in the MCMC sample file, produced by either BP&P v3.4 or BP&P v4. Please download the GUI from Bruce’s group web site here.

Citing BP&P

If you are using BP&BP, please cite:

Also, please cite the following papers depending on the method you use:

Tutorials for BP&P

Before running BP&P, please read the following tutorials:

Also, please read the 2015 tutorial on BP&P v3.4.

Mario dos Reis has written the bppr R package, which can use the BP&P output to do the following:

  • Calibrate a BP&P phylogeny to geological time: tutorial available here.
  • Calculate Bayes factors using the stepping-stones approach in BP&P: tutorial here.

An introduction to the bppr R package can be read here.


The program 3s implements likelihood ratio tests to test for gene flow between two closely related species.

The latest release (Dalquen et al. 2017) includes several improvements over previous versions:

  • The use of loci with arbitrary configurations, such as 123, 112, 113, 12, etc., are now permitted.
  • By default, 3s uses an asymmetric IM model with θ1θ2 and M12M21.
  • 3s can take advantage of multi-core architectures to speed up computation.

The source code is available here.

Downloads and Installation for 3s

You can use 3s as it is, without any additional libraries installed. Please use the following command (adapted to your system) to compile the source code:

gcc -O3 -o 3s 3s.c tools.c lfun3s.c -lm

Nevertheless, we recommend installing the GNU Scientific library (GSL) as this will speed up computation of P(t) significantly, even if you run the program on a single core. Once GSL is installed, you can compile 3s. There are three different commands you should run depending on how your system is set up:

  • No extra commands are needed to compile 3s after installing the GSL:

    gcc -O3 -DUSE_GSL -o 3s 3s.c tools.c lfun3s.c -lm -lgsl -lgslcblas
  • You might have to specify the location of GSL using the -I and -L options:

    gcc -O3 -DUSE_GSL -I/usr/local/include -L/usr/local/lib -o 3s 3s.c tools.c lfun3s.c -lm -lgsl -lgslcblas
  • If you want to run 3s on multiple cores, you can compile the software with OpenMP support:

    gcc -O3 -DUSE_GSL -I/usr/local/include -L/usr/local/lib -o 3s -fopenmp 3s.c tools.c lfun3s.c -lm -lgsl -lgslcblas

The program 3s should work out-of-the-box on current Linux systems with the GNU tool chain. On Mac OS X and Windows, you may need a compiler with OpenMP support.

Citing 3s

If you use 3s, please cite the following papers:

Tutorials for 3s

At the moment, there are no tutorials available for this software.

Phylogenetic Analysis by Maximum Likelihood (PAML)

PAML is a package of programs for phylogenetic analyses of DNA or protein sequences using maximum likelihood. It is maintained by Ziheng Yang and distributed under the GNU GPL v3. ANSI C source codes are distributed for UNIX, Linux, and Mac OS X. Executables are provided for Windows. PAML is not good for tree making, although it may be used to estimate parameters and test hypotheses to study the evolutionary process once you have reconstructed trees using other programs such as RAxML-NG, IQ-TREE, PAUP*, PHYLIP, PhyML, etc.

Before running any of the programs included in the PAML software, please read the PAML manual in PDF format here, where a detailed explanation of how to run the programs is given. If you have any questions, please first read the FAQs document as they might be answered in this document. If not, please use the search tool in the PAML discussion group here to check whether your questions have already been asked by other PAML users. If you still cannot find an answer to your questions, please post them in the PAML discussion group here.

Downloads and Installation for PAML

PAML for UNIX/Linux

  1. Clone the PAML GitHub repository here to download the latest version.
  2. Now, follow the commands below:

     # Move to the cloned repository. Make sure you have cloned it in the correct
     # location of your local disk.
     cd paml
     # If there are executable files for Windows, you may remove them.
     rm bin/*.exe
     # Move to the `src` directory to compile the software.
     cd src
     make -f Makefile
     # List all the compiled programs that are part of PAML and
     # remove unnecessary files.
     ls -lF
     rm *.o
     # Create a `bin` directory, which you can then export to your PATH.
     mkdir ../bin
     # Move the compiled programs to `bin`.
     mv baseml basemlg chi2 codeml evolver infinitesites mcmctree pamp yn00 ../bin
     # Test that you can run some PAML programs such as BASEML, CODEML, or evolver.
  • Then, you can either export the path to this bin directory or include the executable files in a general bin directory for all the software that you have on your local disk, e.g., ~/bin. Whatever you decide to do, please modify your path to include the folder with the PAML programs in the initialization file for the shell. You can use more /etc/passwd to see which shell you run. Below, you can find some notes for the C shell and bash shell. There are other shells, but these two are commonly used.
    • If you see /bin/csh for your account in the /etc/passwd file, you are running the C shell, and the initialization file is .cshrc in your root folder.
      • You can use more .cshrc to see its content if it is present. Use a text editor (such as emacs, vi, SimpleText, etc.) to edit (or create, if one does not exist) the file, by running something like this:

        emacs .cshrc
      • Now, insert the following line:

        # Please change <path_to_bin> with the path on your local disk.
        set path = ($path . <path_to_bin>/bin)
      • The different fields are separated by spaces. Here, . means the current folder, and ~/ means your root folder, and $path is whatever folders are already in the path.

    • If you see /bin/bash in the file /etc/passwd for your account, you are running the bash shell, and the initialization file is .bashrc or bash_profile (type ls -a ~ to see whether you have one or another).
      • Now, use a text editor to open .bashrc and insert the following line:

        # Please change <path_to_bin> with the path on your local disk.
      • The command above changes the environment variable PATH. The different fields are separated by colon :, without spaces. If the file does not exist, please create one (e.g., run touch ~/.bashrc).

    • After you have changed and saved the initialization file, every time you start a new shell, the path is automatically set for you. You can then cd to the folder which contains your data files and run PAML programs there. If the path is properly set, you will be able to run any of the PAML programs by just typing the file name (e.g., unless you have modified the executable file names, mcmctree, codeml, etc.).

PAML for Windows 10 or later

To download the latest version of PAML, please clone the PAML GitHub repository here. You can download a zip compressed file (click here to automatically start the download) and then decompress it on your local disk. Alternatively, you can use the command line:

# Open a terminal on the location where you want to save
# the PAML software.
git clone

Now, you can use either the Windows Linux Subsystem, the Git Bash, the Windows Power Shell, or other alternatives to start a command-line shell that you may have installed on your PC to compile the PAML programs:

# Open a terminal where you have cloned the PAML repository.
cd paml
cd src
make -f Makefile
# List all the compiled programs that are part of PAML and
# remove unnecessary files.
ls -lF
rm *.o
# Create a `bin` directory, which you can then export to your PATH.
mkdir ../bin
# Move the compiled programs to `bin`.
mv baseml basemlg chi2 codeml evolver infinitesites mcmctree pamp yn00 ../bin

If you export the PATH to the directory bin, you will be able to run the programs from any location of your local disk without needing to type the absolute path.

Old compiled versions of PAML

The instructions below explain how to download older versions of PAML compatible with Mac OS X (G5 compiler) and Windows 9x/NT/2000/XP/Vista 7.

We have decided to keep this section here in case users need to follow the installation steps for the OSs detailed above. However, we discourage the installation of older versions as they are out of date. Users may follow the step-by-step installation/compilation guidelines below, but always using the latest version of the PAML software available here.


IMPORTANT: Please note that the latest PAML version is on the PAML GitHub repository here. The notes below are for an earlier version, PAML v4.8a. If you would like to use the latest version on Windows but you cannot compile the latest PAML release following the details above, please post an issue here so we can assist you with this matter.

A compiled version for Mac OS X of an older version of PAML can be downloaded download here: PAML v4.8a here

If you have a G5 or if you would like to compile the programs in the PAML software yourself, please follow the notes below.

We assume that the Apple XCODE is now automatically installed on your mac. Otherwise, you will have to download and install the mac XCODE system, which includes the C compiler. Without a C compiler, you will get a “Command not found” error when you type gcc or cc at the command terminal.

  1. Download the Windows archive provided here.
  2. Open a command terminal (Applications-Utilities-Terminal).
  3. Remove the .exe files from the bin/ folder.
  4. Compile and run the programs from the terminal as follows:
    • Open up the file Makefile in the src/ folder and add # at the beginning of the following line to comment it out:

       CFLAGS = -O4 -funroll-loops -fomit-frame-pointer -finline-functions
    • Delete the # at the beginning of the line for either G5 or intel, depending on your machine, to uncomment the line.
    • For Mac OS X G5 uncomment the following line:

       CFLAGS = -mcpu=G5 -O4 -funroll-loops -fomit-frame-pointer -finline-functions
    • For Mac OS X intel uncomment the following line:

       CFLAGS = -march=pentium-m -O4 -funroll-loops -fomit-frame-pointer -finline-functions
  5. VERY IMPORTANT: Please save the file and compile after the programs are successfully compiled, delete the .o files and move the executables to the bin/ folder as follows:

     rm *.o
     mv baseml basemlg codeml pamp evolver yn00 chi2 ../bin

You may want to mv the executables into the bin/ folder on your accounts rather than the PAML main folder. And finally, if your current folder is not on your search path, you will have to add ./ in front of the executable file name; that is, use ./codeml to run CODEML. See the notes for UNIX systems above.

PAML FOR WINDOWS 9x/NT/2000/XP/Vista 7

IMPORTANT: Please note that the latest PAML version is on the PAML GitHub repository here. The notes below are for an earlier version, PAML v4.9j. If you would like to use the latest version on Windows but you cannot compile the latest PAML release following the details above, please post an issue here so we can assist you with this matter.

To download the executable files for an earlier version of PAML, PAML v4.9j, please download the compressed file here.

  1. Download and save the archive paml4.9j.tgz on your local disk. Make sure the extension of the file (tgz) did not change with the download.
  2. Unpack the archive into a folder (e.g., with Winzip or 7-zip). Remember the name of the folder.
  3. The Windows executables are in paml4.9j/bin/ (you may see \ instead of / to separate the directories, i.e., paml4.9j\bin\). You may want to create a folder for local programs and move the PAML executables there. Below, you can find some notes for doing that:
    • Set up a folder of local programs and change the search path. You need to do this for your user account only once. Suppose your user folder is C:\Users\Ziheng (please, replace this path with your own path, which will contain your username and your folders names). On Vista or Windows 7, this tends to be the default user folder. On Windows XP, you may see something like C:\Documents and Settings\Ziheng (again, this is an example, you may see your username instead).
    • Use Windows Explorer to create a folder called bin inside your user folder. In this example, C:\Users\Ziheng\bin. If you are the superuser/administrator of your PC, you may prefer the folder C:\bin. Whatever you choose, remember that this will be the folder for holding executable programs.
  4. Next, we will add this folder onto the search path, which the OS uses to search for executable programs. The following is for Windows Vista (the menu may be slightly different on Windows 2000/XP, but similar). Open Control Panel and choose Classic View. Now, double-click on System and choose Advanced System Settings. Then, click on the tab Advanced and then on the button Environment Variables. Under User variables, now double-click on the variable Path to edit, then on the variable value field, and then move the cursor to the beginning. Now, insert the name of our program folder (e.g., in our example, C:\Users\Ziheng\Bin or C:\Bin, but please modify according to the folder you have created). Note that you will see a semicolon, which is used to separate the folder names. Be careful not to introduce any errors and keep using the semicolon if you need to include more folders. To save the new settings, please click OK.
  5. Now, you can copy the PAML executables. Copy or move the pre-compiled executables (baseml.exe, codeml.exe, evolver.exe, chi2.exe, etc.) from the paml4.9j\bin\ folder to the local programs folder you will have created (e.g., C:\Users\Ziheng\Bin\ in this example). After this, you can execute any of these programs from a command prompt wherever you are. If you like, you can include the version number by renaming the executable files (e.g., baseml.exe and codeml.exe to baseml4.exe and codeml4.exe, respectively). In that way, you will then run the program from the command line by typing codeml4 instead of codeml, which is useful if you have several versions installed on your PC
  6. Last, you can run a PAML program. Avoid double-clicking the program names from Windows Explorer or will not see any error messages on the screen when the program crashes. Instead, please start a command prompt box where you want to start the PAML program you want to run. For example, Start - Programs - Accessories - Command Prompt, or Start - Run and then type cmd and OK. You can right-click on the title bar and choose Properties to change the size, font, or colour of the window. Now, cd to the folder which contains your input files to tun the PAML program you want and type the name of its executable file (e.g., codeml, mcmctree, etc.). Here, we show how you can cd to the PAML folder (suppose you have extracted the archive into C:\Programs\paml4.9j\) and run the codeml program using the default files.

     cd \Programs\paml4.9j\

Because there is no executable file called codeml.exe (or codeml.bat, etc.) in your current folder, the OS will look for it in the folders listed in the environment variable path that you will have already defined. Therefore, the OS will find and execute the file codeml.exe in the C:\Users\Ziheng\Bin folder, which is the path that we exported in the environment variable in the example above (you will have a different path according to your username and the folder you chose). If you want, you could also use the absolute path to run the PAML programs, although you will need to remember this path! You could type something like the following:


Some codeml analyses use amino acid distance (e.g., grantham.dat file in the dat directory of the PAML software) or substitution rate matrices (e.g., wag.dat file in the dat directory of the PAML software). You will then need to copy the necessary file to your current folder or specify its correct path in the control file to run the program. If the path is not correct or not found, the program will ask you to input the full path to that file until found.

Graphical user interface: PAML-X

A graphical user interface called PAML-X has been written by Bo Xu of Institute of Zoology, Chinese Academy of Sciences in Beijing. This GUI is written in Qt and should run on Windows, Mac OS X, and Linux, although the versions for Mac OS X and Linux may not be well tested.

Download and install PAML (see above) and also PAML-X (links below). If you want to use pamlX1.3.1, you will need to use PAML V4.9 or later. When you run PAML-X for the first time, you need to specify the PAML folder name.

NOTE: While the Windows executable seems to work fine for Windows users, some Linux/UNIX users may experience issues when compiling the GUI due to incompatibilities with the Qt package. If you are one of these users, you may want to try the following:

  • Remove other Qt packages if you had installed them as it may cause issues to have different versions. You can do this via Synaptic or by typing:

      sudo apt-get --purge remove qt*
  • Then, install Qt4:

      sudo apt-get install qt4-default
  • After that, you may want to move to the PAML-X folder with the source code and type:


If there are no issues, the software should start compiling and, at the end, you should see an executable file called “pamlX” appear.

Citing PAML

If you use PAML, please cite the following:

If you use MCMCtree, please cite the following papers if you have used/run…

Tutorials for PAML

There are several tutorials for specific PAML programs:

Tutorials for MCMCtree

Tutorials for CODEML