Installing BioPerl on Mac OS 10.6 Snow Leopard in 6 Easy Steps

The strategy I used to install BioPerl was as follows:

1. Use MacPorts to install Perl.
2. Use CPAN to install BioPerl.

Here are the nitty gritty details. You need a live internet connection, as both MacPorts and CPAN expect to be able to download packages.

Step One: XCode Tools

Before MacPorts can be installed, XCode Tools needs to be installed. This is free from Apple and can be installed from the original OS X 10.6 DVD or downloaded from Apple's developer site.

You can tell that XCode Tools is installed by looking for a Developer directory at the root of your hard drive.

Step Two: MacPorts

I simply downloaded the MacPorts Package Installer from the MacPorts site.

Step Three: Install Perl

sudo port install perl5.12

Step Four: Install GraphViz

This is a prerequisite of BioPerl and the BioPerl build will fail if it is not installed. It will download a ton of prequisites first. After typing the following, get a coffee and a sandwich.

sudo port install graphviz

Step Five: Configure CPAN

CPAN likes to have YAML installed. So:

sudo cpan YAML

At this point cpan will realize it's being run for the first time and ask you some questions like

Would you like me to configure as much as possible automatically? [yes]

Selecting the defaults worked fine.

It's nice to have LWP too.

To install LWP, first get to the cpan command prompt:

sudo cpan

Then install it:

install Bundle::LWP

Step Six: Build BioPerl

To install BioPerl, first get to the cpan command prompt:

sudo cpan

At the command prompt, tell CPAN that you want it to automatically get and install any prerequisites it comes across (this saves you hours of choosing "Yes"):

cpan[1]> o conf prerequisites_policy follow

And now, at the cpan prompt, install BioPerl:

install C/CJ/CJFIELDS/BioPerl-1.6.1.tar.gz

It will stop several times along the way. Except for the following question where my selection was to install all optional external modules, the defaults were fine.

Install [a]ll optional external modules, [n]one, or choose [i]nteractively? [n] a

During the tests that BioPerl runs, I saw the following:

Replacement list is longer than search list at Bio/ line 251.

According to this post, The above are warnings from perl 5.12 that can be ignored (they have been fixed in bioperl-live on github).

For a quick test of BioPerl, put the following into a file named

use Bio::Perl;

# this script will only work if you have an internet connection on the
# computer you're using, the databases you can get sequences from
# are 'swiss', 'genbank', 'genpept', 'embl', and 'refseq'

$seq_object = get_sequence('embl',"AI129902");


Then run it:


and sure enough, a file named roa1.fasta gets written. Yay!

If you are installing BioPerl on a Mac that has multiple user accounts, you'll need to make sure that the following exists in each user's .profile file (at /Users/john/.profile, for example):

# MacPorts Installer addition on 2010-10-04_at_15:32:08: adding an appropriate PATH variable for use with MacPorts.
export PATH=/opt/local/bin:/opt/local/sbin:$PATH
# Finished adapting your PATH environment variable for use with MacPorts.

This makes it so that when you type perl the Mac will find and use the Perl from MacPorts instead of the system Perl. Also, be aware of scripts that say #!/usr/bin/perl at the top.


Hi, I followed your step, but got the message after running
------------- EXCEPTION: Bio::Root::Exception -------------
MSG: id does not exist
STACK: Error::throw
STACK: Bio::Root::Root::throw /opt/local/lib/perl5/site_perl/5.12.2/Bio/Root/
STACK: Bio::DB::WebDBSeqI::get_Seq_by_id /opt/local/lib/perl5/site_perl/5.12.2/Bio/DB/
STACK: Bio::Perl::get_sequence /opt/local/lib/perl5/site_perl/5.12.2/Bio/

Thank you for the help.

Exactly the same problem. Have you solved it?

The error is not on your end. Getting the sequence you are requesting seems to have stopped working on the other end. Try this sequence instead

$seq_object = get_sequence('embl',"AI129902");

and I think you'll find that the following is written to your roa1.fasta file:

>AI129902 qc41b07.x1 Soares_pregnant_uterus_NbHPU Homo sapiens cDNA clone IMAGE:1712149 3' similar to SW:ROA1_SCHAM P21522 HETEROGENEOUS NUCLEAR RIBONUCLEOPROTEIN A1, A2/B1 HOMOLOG. ;contains MSR1.b2 MSR1 repetitive element ;, mRNA sequence.

I changed the code above to reflect this.

Good day,

I'm trying to install bioperl the way you prescribed. I'm stuck on the step four, though. The command sudo goes on installing several things, till it hits the netpbm and fails with the following messages:
“Error: org.macports.fetch for port netpbm returned: Subversion check out failed
Error: Failed to install netpbm
Please see the log file for port netpbm for details:
Error: The following dependencies were not installed: gts netpbm libLASi pango Xft2 xrender xorg-renderproto cairo libpixman xorg-xcb-util urw-fonts xorg-libXaw xorg-libXmu
To report a bug, follow the instructions in the guide:
Error: Processing of port graphviz failed”
Could you help me on this, please? I had tried several other ways to install bioperl, with no success.
Thank you.

Well, MacPorts was unable to retrieve netpbm, so it erred out. Looking at the MacPorts issue site, this seems to be a recurring problem related to the availability of the subversion server that hosts netpbm.

The best place to ask for assistance/report the problem would probably be Ticket 32000.