Configuring your OS X environment to run a real window manager

So, you've decided to run in expert mode...

Running an X server on top of, or even along side of Aqua shows you just how powerful OS X is. Anyone who is still reading this (without clinching their teeth and cursing) must be an OS X fan, so I'll presume this to be the case from here on.

Let me just say that Enlightenment has to be the best damn WM I've ever met. It's great, and you'll love it. The instructions on this page will likely help you make a less suitable choice, but I won't begrudge WindowMungers or fvwwvwvwwvvwvm-lovers. I will speculate on some aspects of KDE and Gnome installations, but I have not tried them myself.

As a side note, this page was inspired by the endless, annoying, and often fruitless searches I did on the web trying to get my environment to be reasonably well configured. The directions here are a work-in-progress and I'll accept feedback, but will not guarantee a timely response. ;)

Disclaimer: I have verified these steps on Panther 10.3.x and Tiger 10.4.x. I cannot be confident of them on any other versions at this time.

Getting X11 Installed

In short, do what Apple says. The first steps toward enlightenment are small and mundane. And getting Enlightenment on the mac is no different. :-P But seriously, X11 should have come as an optional install off of the bundled OS X disks for 10.3 and 10.4 (I believe).

Setting up a window manager

Setting up our window manager is going to require a few pre-requisites. We are going to need to be able to compile (don't worry, this requires very little learning and not much sweat on your part), get our window manager's source (we have friendly package managers for this), and then configure our environment (read: make things better for ourselves by tinkering endlessly).

Xcode: First, make sure you have the developer tools (Xcode) installed. Panther users should find an mpkg in /Applications/Installers/Xcode Tools. Just double-click on the Developer.mpkg icon, and follow the instructions. This package will outfit your Mac with compilers and the things necessary to build our window manager(s).

DarwinPorts: Once you have Xcode, you'll want to install either the DarwinPorts, or something like Fink. I use the DarwinPorts, so I'll detail that direction. Many others use Fink, and there are excellent resources on the web for learning how. DarwinPorts is a system that is based on the FreeBSD port system. It allows very simple access to, and management of, independent applications. The DarwinPorts consist of a set of projects whose code has been ported to OS X. The ports system manages dependencies and versions for you and basically just kicks too much ass for me to detail it all here.

DarwinPorts run out of /opt/local/, so you need to make sure this is in your shell's path. The documentation that comes with the installer tells you how to do this, but here is a copy-and-paste section for those that refuse to RTFM:


          If you haven't already, add /opt/local/bin to your path (or ${prefix}/bin
          if you've elected to install DarwinPorts somewhere else). 

          If you're unsure how and using Panther (OS X 10.3), add the following
          line to your ~/.profile file.  If this file does not exist, create it. (This
          also applies if you're using a bourne shell in Jaguar.)
            export PATH=$PATH:/opt/local/bin

          If using Jaguar (OS X 10.2), add the following line to your ~/.cshrc file.
          If this file does not exist, create it. (This also applies if you're using tcsh in Panther.)

            set path=($path /opt/local/bin)
          Your changes will not take effect until you have opened a new shell.
The installation instructions are here. You basically want to download the installer, run it, and then issue the command (which is listed on the web page above):
      sudo port -d selfupdate
This command will get your ports tree (all of the apps), and re-build the port command if a newer one is available.

Get your WM: This is very easy with DarwinPorts. Let's just say you've decided to join the winning team and you want to install Enlightenment. First, let me congratulate you on your EXCELLENT decision (you won't regret it). You'll want to open up a terminal window (/Applications/Utilities/, make sure you're connected to the Internet, and prepare to let your machine run for a bit.

Here you are choosing what WM to build. You can build as many as you like, just replace enlightenment with whatever else you choose (like windowmaker or gnome). If you want to find out if your favorite WM is in the ports system, type:

      port search <whatever name you are looking for>
The ports system will output all close matches, and you can see if your favorite is there. Now, to install type this in your Terminal window:
      sudo port install enlightenment
At this point, you can go make a sandwich or catchup on some TiVo.

.xinitrc: Once your build has finished you should have a working executable. Now you need your own .xinitrc file. This is how you will: tell X11 what WM to run, and pass options, and so on and so on...

The best option here, is to just copy the system's file locally and use it. We're going to copy the system's default into our own dir. Note, if you have an .xinitrc file already, this will overwrite it, so you might want to back it up (or just use it as is). To get the default, type:

      cp /etc/X11/xinit/xinitrc ~/.xinitrc
Now, this is where it gets interesting. Open this file up in your favorite text editor (such as vi). The last line is the window manager (Quartz). You'll want to replace that line with something like:
      exec /opt/local/bin/e16
But wait... There's more... The quartz WM isn't ALL bad. It's going to stick around and let us copy/paste from Aqua. Before the previous line, put:
      exec quartz-wm --only-proxy &
Now you have a functioning .xinitrc. If this was too much for ya, here's
mine for reference.

Getting REAL X operations

This is the point where many X users (that I know) have gotten very frustrated with OS X. You see, by default, we don't have a functional ALT key. This is a MAJOR poblem, given how reliant on this key many X applications and users are. However, fear not; here is the solution. Your X11 server (you know that Apple gave you) needs to be TOLD to enable ALT... Grrrrr.... There are a few ways to handle this, but the one that I like the best is to write a tiny Applescript to launch X11 with the parameters it needs. I have the application I compiled and the script that made it here:
      do shell script "/Applications/Utilities/ -swapAltMeta >/dev/null 2>&1 &"
      do shell script "sleep 5"
      tell application "X11"
      end tell
If you copy this script into the /Applications/AppleScript/Script Editor, it will compile it, and you can save it as an application bundle. I would put this in my launch bar. ;)

Now you have the alt key. You can launch the X11 (through this helper) and play around. One thing to try is rooted vs. rootless mode. Open up the X11->Preferences menu, and look under the output tab. What you'll see is a check-box for full-screen mode. This is entirely preference, so click it and see how you like it. Full screen mode is a separate environment for X to run in. You can toggle back an forth with Aqua using command-option-a. In enlightenment, you get 2 virtual desktops by default. I run non-rooted mode (not full screen), and my second desktop automatically acts as a full screen E environment. The only diff is I can keep my Aqua menu bar and launcher in view too.

I had trouble getting ALT-Left click to allow me to move my Eterms (which is part of Enlightenment's beautiful interface). I finally found that this was due to the 3-button emulation of the X11. Since I have a 3-button mouse, I turned this off, and now I have all of the features/functions that I love.

Activating Hidden Terms

Tiger seems to have a bug in it whereby command-Tab'ing to X11 does NOT raise terminal windows. Rather, they stay hidden behind other Aqua application windows. This is really annoying (just ask anyone). As a usage note to other people "dealing" with this: I've found that, once you command-Tab to X11, if you have more than one terminal open, then you can ALT-Tab (not command, ALT) between the terms, and they will be raised. In other words, if you're willing to make this a 2-phase operation, you can command-Tab to X11, and then Alt-Tab to your favorite terminal. Sub-optimal, I know, but at least it works. Unfortunately, I've found that if you only have 1 terminal open, this trick only works intermittently. I dunno why it works sometimes, and not others, but c'est la vie.

I hope this helps someone somewhere! Let me know!

Eric (
Last modified 22 August, 2005