Installing Scientific Packages on Mac OS X

If you decided to buy a Macbook, the first thing you need to know may be that “It’s not a Big Mac at all but rather it’s a Mac”. Don’t even think you can eat all the Mac Universe that goes around and is almost parallel to our universe. It even may take quite a lot of time to figure out what kind of a trouble you have, especially if you are someone in the scientific era. Don’t forget that some says “People who buy Macs are the same people who said BETA is better than VHS 15 years ago”.

For an average physicist like me, it may be long term run to build a useful system on Macbook.
Here is a list of softwares that a scientist may need:

Compilers:
gcc, g++, gfortran, g77, f77,Java, …etc.

Package Managers:

MacPorts, Fink, Darwin, RPM, Apt-get, …etc.

Analysis Softwares:

ROOT, Jas3, Aida, Octave, …etc.

Computing Softwares:

Mathematica, Matlab, …etc.

Physics Phenomenology Softwares:

Comphep, Calchep, Pythia, Fluka, Geant4, Madx,
Isajet, Prospino …etc.

Depended Packages:

Cernlib, Openmotif, X11, Latex …etc.

Office Tools:

Excel, Text Editors, Presentation tools, PDF, DVI, PS viewers, …etc.

Web Browsers

Mozilla Firefox, Internet Explorer, Safari, Opera, Netscape, …etc.

Next the main question comes up! How to install these softwares on Mac Os X 10.5.x ??

Here is a prescription for beginners:
(1). First of all, install compilers
(2). Install some package managers
(3). Install other software packages using compilers and installed package managers.

(1)

GCC Compiler Installation: Use Macbook installation DVD, you will find a package called Xcode in the DVD, if you search for it. Just install Xcode development tool and your gcc compiler will also comes with it. Then open a terminal window and just write “gcc”. If its error turns like “no input file”, it means you successfully installed the gcc compiler.
Or you can check its location by writing “which gcc” on the command line.

G77 Compiler Installation: Unfortunately you may not find g77 support combining with any other packages or package managers. So you should install it manually:

  • Download tar file which is most suitable for your computer g77-intel-bin.tar.gz (Intel Mac only) or g77-bin.tar.gz (PowerPC only)
  • Open a terminal window and write “gunzip g77-bin.tar.gz”
  • Write “sudo tar -xvf g77-bin.tar -C /.” for install the spesific files into your usr/bin/ folder.

Gfortran Compiler Installation: There’s an dmg installation file for gfortran compiler. So you should download and install it by just clicking on it.

(2)

MacPorts Installation:

MacPorts provides an open-source software for managing, compiling, installing, upgrading packages which include libraries, utilities on the Mac Os X operating system. One can easily install MacPorts downloading its dmg file and just click on it. After installation you can open a terminal and learn basic Macport commands writing “man port” . Recently for Mac users, MacPorts seem to be the most powerful package manager with almost 8000 packages. Some useful MacPorts commands are;

  • port list : Get the lists of all packages so that one can choose the package name before installation.
  • port upgrade <pkgname> : Upgrades the specific packages with newest versions.
  • port search <pkgname>: Search the package name (or a part of it) in the complete list of packages. You can make wild card searches like *root* or *X11*..etc.
  • port install <pkgname>: -Most used MacPort command- downloads, compiles, stages and installs the package you entered.
  • port installed: Shows the installed packages on your computer.
  • port uninstall <pkgname>: Deactivate the package.
  • port deps: Shows you the dependencies of a package with other packages.
For complete list of commands, please read the documentation of MacPorts here.

FINK Installation:

Fink automates the process of downloading the binary package, or downloading source package, applying a patch, compling, and installing it. As a package manager, fink is the most advanced unix based software and one can easily find its documentations through web. There is an impressive number of applications you can install via fink. Fink was designed carefully as to not disturb or modify the system. It can be uninstalled with a single command ‘sudo rm -r /sw’ You definitely want f77, imagemagick, ghostscript for X, ispell, xdvi, and gimp if you want to edit graphics or xv to preview them.

To download Fink visit http://www.finkproject.org and install its dmg file on your Macbook.

  • Open a terminal window and write “fink” to learn its usage and options.
  • Write “apt-get” (Fink also installs apt-get package)
  • Fink downloads packages from mirror servers around the world. So I strictly recommend you to configure mirror settings. Write “fink configure” to configure mirror options. Fink will start to ask you questions about configurations. Press “Enter” for default values. When it asks a question about mirror choose “4- Nearest mirrors from your continent”. Choose your country. And answer all other questions to complete configuration definitions. If you cannot download packages from chosen mirrors while installations, you should reconfigure these settings.
  • Fink supports stable packages as well as the unstable ones which are not tested or has some exceptions during their running process. To see the supported package list write “fink list” on your command line.
  • To be able to install unstable packages write “fink configure” and activate unstable package option when it asks you about stable/unstable packages. Press “Enter” to give default answers to other questions.
  • To download and install a package write “sudo fink install packagename” on the command line. (ex. “sudo fink install cernlib”)
  • WARNING: Fink automatically finds the dependencies of packages and usually downloads a set of package. That may probably extand your installation time. So i do not recommend anyone to download huge packages -ex. ROOT- via fink. Because it may take quite a lot of time with the related other packages like gcc4, X11, openmotif, …etc.

(3)

CERNLIB Installation:

  • First, make sure you installed fink and the compilers gcc, g77.
  • Open a terminal window and write “sudo fink install cernlib”
  • Fink will download and install cernlib in a few minutes.
  • Write “cernlib” on terminal window and see related cernlib locations. If you get an error message, make sure you installed fink and the compilers properly.

OR you may prefer to install Cernlib Manually to avoid non-standard installation.

COMPHEP Installation:

  • Visit Comphep’s website, be a member and then download its .tar files.
  • Make sure you installed the compilers gcc and g77 properly.
  • Open a terminal window in the folder that comphep’s .tar file exits.
  • Write “sudo tar -xvf comphep-4.5.1.tar”
  • Write “cd comphep-4.5.1″
  • Write “./configure”
  • Follow the commands and write “make” to complete installation.
  • Write “make setup WDIR=calculations” to create a user file called calculations.
  • To run the application write “cd calculations” and “./comphep”

ROOT Installation:

  • Download ROOT analysis framewok visiting ROOT official web site at CERN. If you’r obsessed to perfection, you should download the latest version for your system. (Mac OS X intel or power pc)
  • To open the related .tar file write “sudo tar -xvf root_v5-1.24.00.macosx105-i386-gcc-4.0.tar” on the command line.
  • Write “cd rroot_v5-1.24.00.macosx105-i386-gcc-4.0″
  • Write “./confgure –help” and “./configure” to make installation settings.
  • Write “make” and complete the installation.

You can also set environmental variables to run root for anytime you open a terminal window by writing “root” command. To edit bash and add environmental variables;

  • Open a termianl window and write “cd /” to go root directory.
  • Write “sudo nano etc/bashrc” to open a editor to edit bash profile.
  • Add the following lines in to bashrc file, save and exit (CTRL-O and CTRL-X)
    • export ROOTSYS=/usr/local/root
    • export DYLD_LIBRARY_PATH=$ROOTSYS/lib
    • export PATH=$PATH:$ROOTSYS/bin
  • You should change $ROOTSYS variable (first line) if you installed ROOT framework in to another directory.

General Instructions for Installations:

  • Download the software in tarball.
  • Decompress tarball writing “sudo tar -zxvf <software>.tar”
  • Cd into folder and edit Makefile. DON’T FORGET TO EDIT IT IN COMPATIBLE WITH YOUR PATHS and COMPILERS or UPDATE YOUR COMPILERS.
  • Write “./install” or “./configure” if you have such shell files to run.
  • Write “make” and start compiling.
  • Trace errors if you have any.

I strongly recommend you to register Apple’s developer website http://developer.apple.com/ for recent updates and development tools.

About these ads

8 Responses to Installing Scientific Packages on Mac OS X

  1. shawnwitham says:

    totally agree on the amount of work to get OS X up and running to suit the needs of research (specifically physics). but what is great, is that it’s based on UNIX, which makes it really easy to compile open source apps. also, due to the change to intel based products, installing a linux distro is extremely easy…which makes everything better in the end haha

  2. Shane says:

    You are one smart lad! I wish we were a mac family. My daughter and I know the value but the hubster is old school…and I mean OOOLD.

  3. nicolo says:

    Well done, great description
    Thank you
    Nicolo

  4. Pierluigi says:

    I followed your instruction for installing Cernlib on Mac using fink, but when finished, the cernlibs are not present under /sw/lib/
    I get a cernlib equivalence with “-L/lib -lpacklib -lSystem” but the libraries are nowhere

    Even if I install directly binaries from tar, I get ugly messages when compiling from dynamic libraries….

  5. Kuday says:

    After cernlib installation via fink, you should find the following cernlib libraries under /sw/lib/:
    libkernlib.a
    libmathlib.a
    libpacklib.a
    libpythia.a
    libpdflib804.a

    That’s not the complete cernlib library directory, so the best way is to install using binary tar files.
    http://kudayblog.wordpress.com/2010/01/16/cernlib-manual-installation/

    What error messages do you get??

  6. Nanna says:

    The problem is that the cernlib command defined by fink looks for the cernlib libraries in the /sw/lib folder but there isn’t any cernlib library there! I downloaded and installed them using the binary tar files (except for the variables part), they were saved in the /cern/pro/lib folder, i just copied them in the /sw/lib folder. Now it works! :)

  7. implantacion de sistemas…

    [...]Installing Scientific Packages on Mac OS X « Kuday WeBlog[...]…

  8. Thanks a bunch for sharing this with all of us you actually know what you’re talking about! Bookmarked. Please additionally visit my site =). We will have a hyperlink trade agreement among us

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: