Run CCP4 programs from the command line on Mac OSX – UPDATED

Note: The first version of this post had some mistakes and has now been updated to be universal for all Mac OSX from 10.5 to 10.8

It’s now very convenient to install CCP4 on the Mac via precompiled binaries. This is great, and updates in future will be much easier too. But how to use the programs from the command line? Paths are not set! You want to run f2mtz in your working directory, but it’s buried in /applications/ccp4/bin and so on. This is a typical UNIX mystery, because someone has taken care of all of this, but you need to know how to access the treasure.

There are some hints at the CCP4 wiki. But they’re under the LINUX section.

CCP4/bin has a setup file that should be “sourced”. This means invoking the application ‘source’ on the file in your .bashrc file. This file is run each time you open a Terminal window. But, beware, under the more recent versions of Mac OSX, the .bashrc file isn’t used any more, and instead the file is called .profile  “Sourcing” this setup file will set the paths that you need for command line action – just like on a computer that has a real admin.

If you can take it, it’s easiest to use the editor ‘vi’ to edit .profile in your home directory. Textedit is nicer to use but it’s harder to created UNIX hidden files (beginning with ‘.’) in OSX.

vi .profile

If this file exists, you’re now editing it. If it wasn’t there, you’ve created it and are editing it. Add the following line to this file, bearing in mind the x,y,z must be replaced with the relevant version code (e.g. 6.3.0):

source /applications/ccp4-x.y.x/bin/ccp4.setup-sh

and then type [esc] [:wq] to save and quit.

Next time you open a terminal, you’ve got your paths to Collaborative Computational Project programs of the 4th kind, and they’re set. You can check the paths with the command:

echo $PATH

You should see this path:


2 thoughts on “Run CCP4 programs from the command line on Mac OSX – UPDATED

  1. Thanks for the tip. Tried and filed with the .profile file, but succeeded when sourcing the setup file in the .bash_profile file.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s