x11 on osx

Usual linux applications on mac os x tiger

Introduction

This page intends to give hints to run usual linux applications on mac os x. First it is a memo to remind me how i've done it. But if it can be useful for someone else...

It starts from the beginning, when you get your new 17-inch MacBook Pro, and aims to help you to configure your system so you feel at home, as on linux/x11 (to develop using emacs and a xterm to run the compiler, and make slides for your talks using latex, xfig and the usual stuff).

A similar useful page can be found here.


Developer Toolkit

Xcode, the developer toolkit (including g++4) can be found on the install disc. Run:

/Volumes/Mac OS X Install Disc 1/Xcode Tools/XcodeTools.mpkg

X11

The Mac version of X11, the common graphic display system for UNIX and LINUX operating systems, can be installed using:

/Volumes/Mac OS X Install Disc 1/Optional Installs.mpkg

This will let us run the window manager of our choice. Mac os x comes with its own proprietary graphics display system: Quartz, which is combined with the Aqua interface, and Mac's X11 is an interface between linux applications and Quartz. There are other ways to get and install X11, listed in the page below (which provides a comprehensive introduction to X servers, too):
http://fink.sourceforge.net/doc/x11/


Osirix

Osirix is a software for medical imaging (volume rendering, movie creation...).


Fink

Fink ports and packages Open Source softwares for mac os x. It provides lots of common apps yet. But first, we have to install it:

http://fink.sourceforge.net/doc/users-guide/install.php

The source distribution of the package manager is downloadable as a .tar.gz file. Though mac os x extracts the archive with its own app, it is recommended to use:

tar -zxvf fink-0.x.x-full.tar.gz
cd fink-0.x.x-full
./bootstrap.sh

The bootstrap script seems to first download what it needs on various sites (debian, gimp, tetex...), and then go through the usual (./configure;make install;make) process. A nice feature of fink is that all packages are put in a separate directory /sw . Then we have to update (actually create) the .cshrc file in our user directory by adding the line : source /sw/bin/init.csh.

Then, fink's basic commands are fink list to know which packages are available or installed (the ones with an i before the name), and fink install znupf to install the "znupf" package. It can be more useful to use predownloaded tarballs than doing it on the fly, so fink configure helps you to change the fink.conf configuration file : specify an alternate directory name where fink can look for tarballs. Downloaded tarballs are stored in /sw/src/.

From now, fink will be our friend to install latex, xdvi, gnuplot, xfig, ghostview, antiword, imagemagick, gimp, xv...


Emacs

At this point, we hope we can start emacs in a window. But it fails, though the $DISPLAY variable is correctly set to :0.0. Usually, emacs check this variable to start either in console if it is not defined, or in window if it is. It appears that the version of emacs provided with mac os x is compiled with the -nox option, so does not support X11. Moreover it appears that the fink version of emacs22 has no support for x11 either. It seems that emacs21 still has this support.

The solution was to download the emacs source from http://www.gnu.org/software/emacs/ and compile it from scratch. The config. option "--with-x" was not really successful, and eventually we used:

./configure --enable-carbon-app --prefix="Users/username/local/emacs/"
make
make install

The GUI version of emacs is /Applications/Emacs.app/Contents/MacOS/Emacs and does not use X11.