circos plots

I found that installing the Circos package was a bit of a pain (especially in the newest version of OS X, El Capitan). So below I provide detailed, step-by-step setup instructions.

0. Enter bash shell

/bin/bash

1. Install Homebrew

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

2. Be sure that Perl and make (Xcode) are installed

perl -v
which make

If you need Perl

curl -L http://xrl.us/installperlosx | bash

If need you need make - install Xcode from app store with command line tools enabled 🙂

3. Download and install Circos

mkdir ~/Applications/circos/
cd ~/Applications/circos/
curl -L http://circos.ca/distribution/circos-0.67-7.tgz -o circos-0.67-7.tgz
tar xvfz circos-0.67-pre4.tgz
rm circos-0.67-7.tgz
ln -s circos-0.67-7 current
export PATH=~/Applications/circos/current/bin/:$PATH
. ~/.bashrc


4. Try to run circos -modules (check for modules & instalation)

~/Applications/circos/current/bin/circos -modules

So, here is the problem with OS X you will probably get this error:
bash: /Users/Aidan/Applications/circos/current/bin/circos: /bin/env: bad interpreter: No such file or directory

If you have an earlier version of OS X, you can fix this error by runing the following commands [administrator password is required].

sudo su
cd /bin
ln -s /usr/bin/env env
exit

If, however, you have El Capitan, you will find those commands don't work. This is because Apple decided they didn't want the end user messing around with the /bin directory. Fortunately, there are two work arounds if you are comfortable with Perl (and unix) then it might be easiest to just change the first line of the scripts bin/* and tools/*/bin to:

#!/usr/bin/env perl

Alternatively, you can hack this new OS X "rootless" feature as follows. The proper way to disable the "rootless" mode, a.k.a. System Integrity Protection (SIP), is to boot temporarily into recovery mode by restarting and holding Command+R during boot. Once you're there, fire up a terminal window via the menu of the installer that launches in recovery mode. Type the following command

csrutil disable

You can then shutdown and re-boot normally. This process can be reversed using csrutil enable from the recovery terminal, should you want to reinstate SIP.

5. Install missing Perl modules

cd ~/Applications/circos/current/bin/circos
./circos -modules

Take note of the modules that are listed as missing. You can copy-paste them into a text edit file for reference during the next few steps.

Use CPAN to install and update modules

perl -MCPAN -e shell

Be sure to answer yes to everything if this is your first time using CPAN
at cpan[1] consol, first update cpan:

install CPAN
install Math::Bezier

Do this (substituting Math::Bezier) for every perl package you're missing. After installing all missing packages leave the cpan terminal by typing

exit

IMPORTANT - if GD and/or GD::Polyline is missing, you must install libgd before installing GD

You can install libgd using the following bash command (outside of cpan).

brew install libgd

After you've got that squared away, go back to CPAN and install GD

perl -MCPAN -e shell
install GD
install GD::Polyline
exit

Finally, test your installation! If you added circos to your path, it should just work. Otherwise don't forget to pass the full path ~/Applications/circos/current/bin/circos in order to run circos.

I hope this helps and good luck writing your circos scripts!

3 Replies to “Installing CIRCOS on Mac OSX

  1. Hi Aidan,

    I get to - "brew install libgd" but then end up with this message:

    "Error: No such keg: /usr/local/Cellar/gd"

    Any idea how to overcome this problem? Any help would be appreciated!

    • You could try a couple things:
      1. Search brew for libgd using brew search libgd. If you can find it, then try switching mirrors or diy installing it.
      2. If that doesn't work or it's difficult, try brew install gd

  2. Even after installing libgd it is not possible to install under perl gd and gd::Polyline.

    tells me error:
    Result: FAIL
    Failed 1/2 test programs. 1/12 subtests failed.
    LDS/GD-2.56.tar.gz
    ./Build test -- NOT OK
    //hint// to see the cpan-testers results for installing this module, try:
    reports LDS/GD-2.56.tar.gz
    Running Build install
    make test had returned bad status, won't install without force
    Failed during this command:
    LDS/GD-2.56.tar.gz : make_test NO

Leave a Reply

Your email address will not be published. Required fields are marked *