[gretl main page]

Gretl: Gnu Regression, Econometrics and Time-series Library

for Mac OS X

Pre-built disk image

The simple way of installing gretl for OS X on Intel, if it works for you, is to grab a disk image, gretl-1.7.7.dmg (about 12MB). Download the image to your desktop, double-click on it to open it, then drag the Gretl folder (actually its full name is Gretl.app), which you'll find inside, to somewhere suitable for installation (e.g. your Applications folder).

This has been tested on OS X v10.4.11. The disk image is briefly documented in README.pdf, which contains a suggestion for what to do if fonts do not appear properly. If you want to debug a non-functioning gretl on OS X, please try this: open an X11 terminal window; change directory (cd) to Gretl.app (where you installed the package); change directory to Contents/Resources/bin and run the command

./gretl

This should give you some feedback on what is going wrong.

Please note: this package depends upon Apple's X11 (their port to the Mac of the X Window system). This is available on the OS X installation DVDs.

Also note: As mentioned above, the current disk image is for Intel Macs. We need a volunteer to make a current build of gretl for the PPC architecture. In the meantime gretl version 1.6.5 is available for the PPC architecture.

Alternative method: build using Fink

If the pre-built image doesn't work for you, or if you want more control over the build, you can compile gretl from source yourself. This requires -- in addition to Apple's X11 and a certain degree of familiarity with unix methods -- the Fink system, available from http://fink.sourceforge.net/download/.

Besides the basic installation of Fink itself, for building and running gretl you will need to ensure that the following Fink packages are present and correct (some of them may already be installed and up to date, in which case Fink will tell you that). After each package, I show the command (to be typed at the command prompt in an xterm or the Mac Terminal app) to do the job:

system-xfree86

fink install system-xfree86

gtk+2

fink install gtk+2

gtk+2-dev

fink install gtk+2-dev

libxml2

fink install libxml2

gnuplot

fink install gnuplot

fftw3

fink install fftw3

In particular, you should ensure that gnuplot is up to date (the package number should be at least 4.0 to work with gretl).

At one time you also needed the following, but this may now be redudant:

dlcompat

fink install dlcompat

dlcompat-dev

fink install dlcompat-dev

Environment variables

To compile gretl using fink, you need to make sure the environment is set up correctly -- before running gretl's configure script. This means setting several environment variables; exactly how this is done depends on whether your shell is tcsh or bash (tcsh was the default in OS X prior to Panther, but I believe bash is the default under Panther). You can either execute the following commands one by one, or (better) put them into your shell startup file, either .tcshrc or .bashrc (I think) in your home directory.

tcsh version:

setenv CFLAGS -I/sw/include
setenv LDFLAGS -L/sw/lib
setenv CXXFLAGS $CFLAGS
setenv CPPFLAGS $CXXFLAGS
setenv ACLOCAL_FLAGS "-I/sw/share/aclocal"
setenv PKG_CONFIG_PATH "/sw/lib/pkgconfig"

bash version:

export CFLAGS=-I/sw/include
export LDFLAGS=-L/sw/lib
export CXXFLAGS=$CFLAGS
export CPPFLAGS=$CXXFLAGS
export ACLOCAL_FLAGS="-I/sw/share/aclocal"
export PKG_CONFIG_PATH="/sw/lib/pkgconfig"

You should also make sure to source the init.sh supplied by fink:

source /sw/bin/init.sh

You may want to look at the fink FAQ.

Configure and build

Once you have the right versions of OS X, Apple's X11, Fink, and the required Fink packages, and you have the environment correctly configured, installing gretl should be fairly straightforward. I hope to make a Fink package for gretl available before too long, but for now you have to install it from source. Here is how it goes:

  1. Download the source package:
    curl -O http://ricardo.ecn.wfu.edu/pub/gretl/gretl-1.7.7.tar.bz2

  2. Unpack the source:
    tar xvfj gretl-1.7.7.tar.bz2

  3. Move into the gretl source directory:
    cd gretl-1.7.7

  4. Configure the source code package:
    ./configure --prefix=/sw --disable-png-comments

  5. Type make to build gretl. This takes a while.

  6. Type sudo make install to install gretl.

In case it's useful, here's the whole lot in the form of a shell script:

#!/bin/sh
# initialize fink
. /sw/bin/init.sh
# set up the compilation environment
export CFLAGS="-O2 -I/sw/include"
export LDFLAGS=-L/sw/lib
export CXXFLAGS=$CFLAGS
export CPPFLAGS=$CXXFLAGS
export ACLOCAL_FLAGS="-I/sw/share/aclocal"
export PKG_CONFIG_PATH="/sw/lib/pkgconfig"
# download the gretl source
curl -O http://ricardo.ecn.wfu.edu/pub/gretl/gretl-1.7.7.tar.bz2
# unpack the source archive
tar xvfj gretl-1.7.7.tar.bz2
# move into the gretl source directory
cd gretl-1.7.7
# configure the build
./configure --prefix=/sw
# make the program
make
# install gretl (root password needed)
sudo make install

You should now be able to run gretl by typing "gretl" at the command prompt in an xterm (launched by starting up Apple's X11).