Installing CCP4 on OS X
From OS X Scientific Computing

Where is your CCP4 on OS X Page?
My CCP4 on OS X page is linked here.
At some point I will phase that out in favor of this page.
CCP4 quick links
Why do you recommend that I use fink to install CCP4?
How you install ccp4 is really entirely up to you. CCP4 distributes its own binary distribution for OS X, so you might simply prefer to use that. I like to compile my own, and that way I can be reasonably certain of what patches were applied, what special tweaks for OS X are included, and so forth. However, compiling ccp4 on OS X is a bit tricky, and involves some hacking around. These modifications, as well as some OSX-specific improvements (printing via pdf, better ccp4help function, CCP4i mail interface integrated with Apple's OS X Mail.app, and so on), and the latest patched versions, are available via fink. Fink automates the install process and ensures that CCP4 is properly and automatically configured, whether you use zsh, bash or tcsh. You don't have to (and should not be tempted to) edit any startup scripts. Fink will initialize ccp4 as soon as you start a new shell.
Fink also makes sure all of the dependencies you need are in place. For example, to run the CCP4i GUI, you need to have the X-windows based TCL, TK and BLT packages installed (the aqua port of TCL/TK sadly does not yet have BLT support). To compile ccp4, you need a viable fortran compiler. Fink will install g77 for you if you don't have it.
In addition, fink can be used to help you with system maintenance, which for me has become a real chore and time-sink. I have several OS X computers. I compile the software on one, and I serve it to the others. You can use my server too, as described in getting your fink installation to use packages that I have pre-compiled. This will allow you to install fully configured versions of CNS, CCP4, and so forth, that run right "out of the box."
In short, the reason to do this is for convenience.
Installing CCP4 using Fink
Q: Why all the CCP4 packages in Fink? Which do I use?
There are two different answers now, depending on what branch of fink you are using:
- A1: If you are using the 10.3 branch of fink, read What CCP4 packages to install with 10.3 or 10.4-transitional.
- A2: If you are using the new 10.4 (non-transitional) branch of fink, or 10.5, read What CCP4 packages to install with 10.4 or 10.5 on ppc or intel. (NOTE: This option is now the only one on 10.4; the transitional branch is history.)
Q: How do I get rid of the obsolete ccp4-related packages?
A: Open a terminal, and first we will remove anything that potentially might get in the way:
fink remove *mosflm* fink remove *ccp4* mmdb ssmlib
You might not have all of these, so don't worry if fink comes back to tell you the package is not found.
Installing precompiled fink debian binaries
Q: How do I install the latest fink binary version of CCP4 automatically?
If you are doing this automatically (a good idea) following the instructions posted at Getting your fink installation to use packages that I have pre-compiled, you can simply issue the following:
sudo apt-get update sudo apt-get install ccp4
Then you should have it all.
Q: How do I install the latest fink binary version of CCP4 manually?
A: Again, you will need both the ccp4 and ccp4-shlibs packages. Download them from my webserver as follows:
curl -O http://sage.ucsc.edu/fink/dists/unstable/main/binary-darwin-powerpc/sci/ccp4-shlibs_6.0-1_darwin-powerpc.deb curl -O http://sage.ucsc.edu/fink/dists/unstable/main/binary-darwin-powerpc/sci/ccp4_6.0-1_darwin-powerpc.deb
Then install both packages with the following command:
sudo dpkg -i ccp4* ccp4-shlibs*
Installing from source code
If, instead, you just want to compile and install CCP4 using the current version in fink's unstable branch, either activate the unstable branch or make symbolic links to your fink local directory in the manner described below:
If you have activated the unstable branch of fink
First, make sure your package descriptions are up to date To do so, issue the following command:
fink selfupdate
(Using either rsync or cvs will work fine in this case).
Then, simply issue the following command:
fink install ccp4
If you have not activated the unstable branch of fink
If you want to install ccp4 without explicitly activating the unstable branch, just do this:
First, make sure your package descriptions are up to date To do so, issue the following command:
fink selfupdate-cvs
Now, make symbolic links into your local branch directory:
sudo mkdir -p /sw/fink/dists/local/main/finkinfo sudo ln -s /sw/fink/dists/unstable/main/finkinfo/sci/ccp4.* /sw/fink/dists/local/main/finkinfo/.
After that, you just need to type
fink install ccp4
and sit back and everything will be compiled and set up for you completely automatically, including all of the environment variables and everything else. CCP4 will be available when you start a new shell.
Don't Forget to do this for CCP4i
If you use ccp4i, you need to issue
sudo ccp4i
the very first time you run it. Thereafter, invoke without the sudo command.
On 10.5.x, this doesn't seem to work (X11 is not triggered to open the GUI), so instead try this:
% sudo -s # source /sw/bin/init.sh # ccp4i # exit
The first line (to the right of the shell prompt, designated % ) starts a root shell process in your favorite shell. You should then see a root prompt, typically a # by default. (Explicitly issuing "sudo /bin/zsh" or whatever will also work). The second line is specific to fink, and has the effect of ensuring all the CCP4 environment variables are properly set. The third line then starts the ccp4i gui as a root process. The final command exits the root shell, an important thing to do since you can do damage by accidently typing stuff in as root.
A Workaround for X11.app bug: xdlmapman and xdldataman
The problem
Let's say you want to convert a CNS map into a CCP4 map. You load the map in by pasting the name into a dialogue window. After that happens, a second window pops up that lets you select what format the input map is in. For some reason, with Apple's X11 window manager, this second window tends to get lost, making it impossible to use xdlmapman and xdldataman.
A Simple Solution
If you iconify the main window before hitting the return key after entering the map file name into the first dialogue window, (that is to say, if you hit the yellow button to make the main window go into the dock), the borderless popup window will not get lost.
A Very Geeky Solution
Since the problem is with Apple's X11.app window manager, the "best" solution would be to use a different window manager. Unfortunately, most are ugly and all are much slower than Apple's Xquartz. Try running coot or pymol with one of the other window managers. It is unpleasant, to say the least.
It is, however, possible to have your cake and eat it too. The xnest program lets you run another Xwindow session nested within your primary one. I'll describe how I use this, using xdlmapman as an example. You can do the same thing for xdldataman.
Select an alternate window manager
First, you need to decide on an alternative window manager. The window manager twm comes with your X11 installation, so if you want to use that (it is fugly), then you are done. One that I recommend, assuming you have fink, is evilwm as it is simple and easy to install with little overhead. This example assumes you have one or both of these.
Download these shell scripts
Make them executable and put them at the head of your $PATH
chmod a+x xdl*.zsh cp xdldataman.zsh /your/favorite/bin/xdldataman cp xdlmapman.zsh /your/favorite/bin/xdlmapman
How Can I Install CCP4 manually?
There is of course no reason for you not to install CCP4 manually. You should certainly feel free to examine my ccp4.info and ccp4.patch files, if you should need assistance.
Installing CCP4 with gfortran
Using gfortran-4.2 gives major improvements.
You are best advised to use the most recent one available. Everything works for me on both intel and ppc using this:
zsh-% fink list gcc4 | head -2 i gcc4 2:4.1.99-20060515 GNU Compiler Collection Version 4 i gcc4-shlibs 2:4.1.99-20060515 Shared libraries for gcc4 zsh-% gfortran --version | head -1 GNU Fortran 95 (GCC) 4.2.0 20060513 (experimental) zsh-%
CCP4 compiles out of the box with gfortran, gcc4 and g++4.
I found that I had to have CCP4 build its own version of fftw for clipper to compile. Rotgen fails. This happens because libjwc_f fails to build. I found by rebuilding libjwc_f after reconfiguring to avoid using dynamic libraries, and then configuring a third time (returning everything to the original state) and issuing "make -i install", rotgen and the other programs will build. (This may now have been fixed.)
There also appears to be a mistake in the configure file and/or makefiles for some of the x-windows program which puts in a -lg2c line. You can get rid of this problem by issuing, within the zsh (the shell you should be using), the following simple commands:
perl -pi -e 's|EXTRA_LOAD_FLAGS = -lg2c||g' **/*akefile* perl -pi -e 's|EXTRA_LOAD_FLAGS = -lg2c||g' **/*akefil*
You have to use zsh to take advantage of the recursive globbing.
Finally, I was unable to link xloggraph with gcc or gfortran. I could only get it to link using g77 or fort77 (a perl script that runs f2c): >
fort77 -o xloggraph msg_box.o ZDr2d.o EditString.o hardcopy_ctrl.o xloggraph.o log_file.o tom_fortran_interface.o bits_and_pieces.o graphics.o -g -Os -I/usr/include/X11R6 -L/usr/X11R6/lib -lXaw -lXmu -lXt -lSM -lICE -lXpm -lXext -lX11 -lm -lSystemStubs
I ran the $CCP4/examples/runnable/run-all script to check the programs. These pass all tests with g77. Almost all pass with the new gfortran-4.1, and mosflm now appears to work.
Here is a summary message I posted to the CCP4 bulletin board:
1. Why use gfortran? Good question. g77-3.4.x works obsolutely fine with gcc4.0.0, 4.0.1, but the Free Software Foundation has discontinued development of g77 as of release 4.x, so eventually g77 may not be available as an option. For now, though, g77 works fine with gcc at least through 4.1. There are some problems with 4.0.2, at least on os x.
2. gfortran-4.2 works much better than 4.0 and 4.1. On OS X (with a little coaxing) and on Ubuntu debian linux, it can compile everything.
3. If you use fink to install gfortran on OS X, be sure to get the most up to date version (see above).
Dirk Kostrewa says you can get a non-fink version here: link
Installing CCP4 with g77
Well, this is what we are doing with fink, so as suggested above, feel free to peek at my ccp4.info and ccp4.patch files.
The main hint is to use
FC=g77 ./configure
but double-check to make sure this really carries over for everything. I had some trouble getting CCP4 to use Apple's Blas/Lapack until I hacked the configure file to force it to use g77 instead of gfortran for the tests.
I've put some more extensive notes here: Compiling ccp4 on OS X
Separate packages for phaser, cctbx, mosflm, pointless, etc.
I've made separate fink packages for phaser, cctbx, mosflm, mosflm-small (a smaller display suitable for laptops), pointless, chooch, refmac, and other ccp4-associated programs. Typically these are newer versions that replace what comes with ccp4. In the case of phaser and cctbx, I haven't gotten the old version to compile on 10.5.x, so the ccp4 package skips these entirely, so if you want that functionality, you have to install the latest version via fink.
The ccp4-onlylibs-dev pacakge has a newer version of the clipper libraries and mmdb that is required for coot and pointless.

