From MbWiki

Jump to: navigation, search

This is the manual for version 3.1. Please use the new version.



MrBayes 3 is a program for the Bayesian inference of phylogeny. The program has a command-line interface and should run on a variety of computer platforms, including clusters of Macintosh and UNIX computers. Note that the computer should be reasonably fast and should have a lot of RAM memory (depending on the size of the data matrix, the program may require hundreds of megabytes of memory). The program is optimized for speed and not for minimizing memory requirements.

This manual explains how to use the program. After this section, which introduces the program, we will first walk you through a simple analysis, which will get you started, and a more complex analysis that uses more of the program’s capabilities (section 3). We then briefly describe the models implemented in the program (section 4), answer some frequently asked questions (section 5), and discuss the differences between versions 2 and 3 of the program (section 6). Finally, we give more detailed instructions on how to compile the program and how to run the parallel versions of it (section 7). Section 7 also contains brief information for developers interested in tweaking MrBayes code or contributing to the MrBayes project. The manual ends with a series of diagrams giving a graphical overview of all the models and proposal mechanisms implemented in the program (Appendix). For more detailed information about commands and options in MrBayes, see the command reference that can either be downloaded from the program web site or generated from the program itself (see section 1.4 Getting Help below). All the information in the command reference is also available on-line when using the program.

The manual assumes that you are familiar with the basic concepts of Bayesian phylogenetics. If you are new to the subject, we recommend the recent reviews by Holder and Lewis (2003), Lewis (2001) and Huelsenbeck et al. (2001, 2002). It is also worthwhile to study the early papers introducing Bayesian phylogenetic methods (Li 1996; Mau, 1996; Rannala and Yang, 1996; Mau and Newton, 1997; Rannala and Yang, 1997; Larget and Simon, 1999; Mau, Newton and Larget, 1999; Newton, Mau and Larget, 1999). The basic MCMC techniques are described in Metropolis et al. (1953) and Hastings (1970). The Metropolis-coupled MCMC used by MrBayes was introduced by Geyer (1991).

Conventions Used in this Manual

What you see on the screen and what is in the input file is in plain typewriter font. What you type is in bold typewriter font.

Acquiring and Installing MrBayes

MrBayes 3 is distributed without charge by download from the MrBayes web site. If someone has given you a copy of MrBayes 3, we strongly suggest that you download the most recent version from this site. The site also gives information about the MrBayes users email list and describes how you can report bugs or contribute to the project.

MrBayes 3 is a plain-vanilla program that uses a command line interface and therefore behaves virtually the same on all platforms ‑ Macintosh, Windows and Unix. There is a separate download package for each platform. The Macintosh package contains two versions of the program: the standard serial version, named MrBayes3.1 (program icon one copy of Reverend Bayes’s portrait), and a version for running the program in parallel on clusters of Macintoshes, named MrBayes3.1p (program icon four portraits of Reverend Bayes). For more information on the parallel Macintosh version of MrBayes, which requires the installation of POOCH, see section 7 of this user manual. The Windows package only contains the serial version of the program and is ready to run after unzipping, just like the Macintosh serial version.

If you decide to run the program under Unix/Linux, then you need to compile the program from the source code. In the latter case, simply unpack the file mrbayes3.1_src.tar.gz by typing gunzip MrBayes_3.1_src.tar.gz and then tar –xf MrBayes_3.1_src.tar. The gunzip command unzips the compressed file and the tar –xf command extracts all of the files from the .tar archive that resulted from the unzip operation (note that the .gz suffix is dropped in the unzip operation). You then need to compile the program. We have included a “Makefile” that contains compiler instructions producing the serial version of the program. You simply type make to compile the program according to these instructions. A typical compile session would look like this:

ronquistg5:mrbayes>gunzip MrBayes_3.1_src.tar.gz
ronquistg5:mrbayes>tar -xf MrBayes_3.1_src.tar
gcc -DUNIX_VERSION -O3 -Wall -Wno-uninitialized -c -o mb.o mb.c
gcc -DUNIX_VERSION -O3 -Wall -Wno-uninitialized -c -o mcmc.o mcmc.c
gcc -DUNIX_VERSION -O3 -Wall -Wno-uninitialized -c -o bayes.o bayes.c
gcc -DUNIX_VERSION -O3 -Wall -Wno-uninitialized -c -o command.o command.c
gcc -DUNIX_VERSION -O3 -Wall -Wno-uninitialized -c -o mbmath.o mbmath.c
gcc -DUNIX_VERSION -O3 -Wall -Wno-uninitialized -c -o model.o model.c
gcc -DUNIX_VERSION -O3 -Wall -Wno-uninitialized -c -o plot.o plot.c
gcc -DUNIX_VERSION -O3 -Wall -Wno-uninitialized -c -o sump.o sump.c
gcc -DUNIX_VERSION -O3 -Wall -Wno-uninitialized -c -o sumt.o sumt.c
gcc -DUNIX_VERSION -O3 -Wall -Wno-uninitialized -lm mb.o bayes.o command.o mbmath.o mcmc.o model.o plot.o sump.o sumt.o -o mb

The compilation usually stops for several minutes at the mcmc.c file; this is perfectly normal. This is the largest source file and optimization of the code takes quite a while.

Depending on which platform/distribution the compilation is being performed on, it may be necessary to install relevent development libraries to enable compilation. Users of Ubuntu 5.10 (Breezy Badger), for instance, may need to install the either the libreadline4-dev or libreadline5-dev package to provide linking during compilation to GNU readline functionality.

We assume as the default C compiler gcc, which is installed on most systems. If you do not have gcc installed on your machine, or you want to produce the MPI version or some other special version of the program, you have to change the compiler information in the Makefile as described in section 7 of this manual. The executable serial version of the program is called “mb”. To execute the program, simply type ./mb in the directory where you compiled the program. The ./ prefix is needed to tell Unix that you want to run the local copy of mb in your working directory. If you run MrBayes often, you will probably want to add the program to your “path”; refer to your Unix manual or your local Unix expert for more information on this.

All three packages of MrBayes come with example data files. These are intended to show various types of analyses you can perform with the program, and you can use them as templates for your own analyses. Two of the files, primates.nex and cynmix.nex, will be used in the tutorial sections of this manual (sections 2 and 3).

Getting Started

Start MrBayes by double-clicking the application icon (or typing ./mb) and you will see the information below:

MrBayes v3.1

(Bayesian Analysis of Phylogeny)

Fredrik Ronquist and John P. Huelsenbeck

School of Computational Science
Florida State University

Section of Ecology, Behavior and Evolution
Division of Biological Sciences
University of California, San Diego

Distributed under the GNU General Public License

Type "help" or "help <command>" for information
on the commands that are available.

MrBayes >

The order of the authors is randomized each time you start the program, so don’t be surprised if the order differs from the one above. Note the MrBayes > prompt at the bottom, which tells you that MrBayes is ready for your commands.

Changing the Size of the MrBayes Window

Some MrBayes commands will output a lot of information and write fairly long lines, so you may want to change the size of the MrBayes window to make it easier to read the output. On Macintosh and Unix machines, you should be able to increase the window size simply by dragging the margins. On a Windows machine, you cannot increase the size of the window beyond the preset value by simply dragging the margins but (on Windows XP, 2000 and NT) you can change both the size of the screen buffer and the console window by right-clicking on the blue title bar of the MrBayes window and then selecting “Properties” in the menu that appears. Make sure the “Layout” tab is selected in the window that appears, and then set the Screen Buffer Size and Window Size to the desired values.

Getting Help

At the MrBayes > prompt, type help to see a list of the commands available in MrBayes. Most commands allow you to set values (options) for different parameters. If you type help <command>, where <command> is any of the listed commands, you will see the help information for that command as well as a description of the available options. For most commands, you will also see a list of the current settings at the end. Try, for instance, help lset or help mcmc. The lset settings table looks like this:

Default model settings:

Parameter Options Current Setting

Nucmodel 4by4/Doublet/Codon 4by4
Nst 1/2/6 1
Code Universal/Vertmt/Mycoplasma/
Yeast/Ciliates/Metmt Universal
Ploidy Haploid/Diploid Diploid
Rates Equal/Gamma/Propinv/Invgamma/Adgamma Equal
Ngammacat <number> 4
Nbetacat <number> 5
Omegavar Equal/Ny98/M3 Equal
Covarion No/Yes No
Coding All/Variable/Noabsencesites/
Nopresencesites All
Parsmodel No/Yes No

Note that MrBayes 3 supports abbreviation of commands and options, so in many cases it is sufficient to type the first few letters of a command or option instead of the full name.

A complete list of commands and options is given in the command reference, which can be downloaded from the program web site ( You can also produce an ASCII text version of the command reference at any time by giving the command manual to MrBayes. Further help is available in a set of hyperlinked html pages produced by Jeff Bates and available on the MrBayes web site. Finally, you can get in touch with other MrBayes users and developers through the mrbayes-users email list (subscription information at

Reporting and Fixing Bugs

If you find a bug in MrBayes, we are very grateful if you tell us about it using the bug reporting functions of SourceForge, as explained on the MrBayes web site ( When you submit a bug, make sure that you upload a data file with the data set and sequence of commands that produced the error. If the bug occurs during a MCMC analysis (after issuing the “mcmc” command), you can help us greatly by making sure the bug can be reproduced reliably using a fixed seed and swapseed for the mcmc command, and ideally also with a small data set. The Tracker software at SourceForge will make sure that you get email notification when the bug has been fixed in the source code on the MrBayes CVS repository at SourceForge. Note, however, that there may be some time before new executables containing the bug fix will be released.

Advanced users may be interested in fixing bugs themselves in the source code. Refer to section 7 of this manual for information on how to contribute bug fixes, improved algorithms or expanded functionality to other users of MrBayes.

License and Warranty

MrBayes is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. The program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details (

Personal tools