create a new pane - alt-shift-enter

What is XMonad? It’s a tiling window manager, that you can control extremely well purely from the keyboard without a mouse. It’s also very good with multiple monitors.

A tiling window manager takes away the burden of moving windows by laying them out for you optimally, with the option of changing the layout with deft keystrokes. It’s a very efficient way of working, particularly with terminal windows.

Installing XMonad into XQuartz on OSX

Here’s a fragment of my shell history, this is what I did to get it installed and running.

To start, you need homebrew & cask to install GHC, Cabal, and XScreenSaver. Yes, XMonad depends on the X11 screensaver, albeit indirectly - it’s really a dependency of a dependency. A cousin, if you will. There’s some voodoo with library paths to make this work, so this might be where it doesn’t work for you.

#install haskell
brew install ghc

#install cabal
brew install cabal-install

#install xscreensaver
brew install Caskroom/cask/xscreensaver

#download list of packages for cabal
cabal update

#install x11 library using cabal
LIBRARY_PATH=/opt/X11/lib:$LIBRARY_PATH cabal install X11

#install xmonad
cabal install xmonad

#set XQuartz to use xmonad as the WM
mkdir ~/.xinitrc.d
echo 'USERWM=~/.cabal/bin/xmonad' >~/.xinitrc.d/
chmod +x ~/.xinitrc.d/

#compile xmonad.hs into an executable
~/.cabal/bin/xmonad --recompile

You could roll the brew install commands together, but for demonstration I’ve kept them separate. In all likelihood, you’ll run through all these steps without any real problems until the last line, where it will whinge about not having a xmonad.hs file. Create the file and recompile and it should all work nicely.

configuring  /.xmonad/xmonad.hs

This is a basic sample that supposed to work well on Xquartz. There are many options and variants, so it’s worth searching online for examples.

import XMonad

main = xmonad defaultConfig
        { modMask = mod4Mask
        , terminal = "urxvt"

When you have created the file, you can run build xmonad from your config with one easy command:

xmonad --recompile

When it finishes, then you should open XQuartz and see XMonad as the window manager. It works better in fullscreen mode (set it in the XQuartz preferences panel) and use cmd-opt-a to switch between osx and x11.

xresources settings

You can control the display of the terminal windows in the  /.xresources file so that xterm is better for you. It’s highly subjective, but if you want a reasonable start with a monospaced fairly small typeface and white-on-black colours, try this:

xterm*background: Black
xterm*foreground: White
xterm*termName: xterm-color
xterm*faceName: Monaco:size=10
xterm*dynamicColors:      true
xterm*utf8:               2
xterm*eightBitInput:      true
xterm*saveLines:          512
xterm*scrollKey:          true
xterm*scrollTtyOutput:    false
xterm*scrollBar:          true
xterm*rightScrollBar:     true
xterm*jumpScroll:         true
xterm*multiScroll:        true
xterm*toolBar:            false

I’ve added scrollbars and so on, the scrollback buffer is way too small for me, but this is a good start for customisation. Just remember when picking fonts in X11, you might not be able to use all the fonts from OSX - I’ve found that some just don’t seem to work. You can use ‘xfontsel’ to get the right name’. Mostly, it seems to be a case of just using lower case.

Default keyboard bindings

Maybe it’s a bit cheeky to include this here, particularly as it is so easy to change the bindings so it might not be accurate for you, but this list cribbed from the manpage is useful.

‘mod’ usually represents ‘alt’ but may Ådiffer based on the operating system or the xmonad configuration.


Launch terminal


Launch dmenu


Launch gmrun


Close the focused window


Rotate through the available layout algorithms


Reset the layouts on the current workspace to default


Resize viewed windows to the correct size


Move focus to the next window


Move focus to the previous window


Move focus to the next window


Move focus to the previous window


Move focus to the master window


Swap the focused window and the master window


Swap the focused window with the next window


Swap the focused window with the previous window


Shrink the master area


Expand the master area


Push window back into tiling


Increment the number of windows in the master area


Deincrement the number of windows in the master area


Quit xmonad


Restart xmonad


Run xmessage with a summary of the default keybindings (useful for beginners)


Switch to workspace N


Move client to workspace N


Switch to physical/Xinerama screens 1, 2, or 3


Move client to screen 1, 2, or 3


Set the window to floating mode and move by dragging


Raise the window to the top of the stack


Set the window to floating mode and resize by dragging