Skip to content

Instantly share code, notes, and snippets.

What would you like to do?

Installing and configuring dwm on OS X

  1. Install (it's on the OS X install disk or something.)

  2. Install dwm. You have to customize config.h a bit:

    1. Replace { MODKEY|ShiftMask, XK_q, quit, {0} }, with { MODKEY|ControlMask, XK_q, quit, {0} }, to avoid colliding with the Log Out shortcut in the Apple menu.

    If you install dwm from Homebrew, brew install dwm, this is done automatically.

  3. Add the following script to $PATH, name it dwm-launch and chmod 755:

    cd ~
    while true
      xsetroot -name "`date +"%Y-%m-%d %H:%M"`"
      sleep 5
    done &
    exec /usr/local/bin/dwm
  4. Add the following to ~/.xinitrc:

    xsetroot -solid '#4a525a'
    xmodmap -e 'remove Mod2 = Meta_L' -e 'add Mod1 = Meta_L'
    exec >>~/.xsession-errors 2>&1
  5. Create ~/.Xmodmap with the following contents. This will set your meta key to be left-alt.

     clear Mod1
     clear Mod2
     keycode 63 = Mode_switch
     keycode 66 = Meta_L
     add Mod1 = Meta_L
     add Mod2 = Mode_switch
  6. X11 terminal colors are black on white by default. To change to white on black, add the following to ~/.Xdefaults:

     xterm*Background:               black
     xterm*Foreground:               green
     xterm*cursorColor:              LightBlue
     xterm*pointerShape:             arrow
     xterm*pointerColor:             blue
  7. Start dwm should start. If it immediately dies then exits, dwm-launch is probably not executable.

  8. You need to change a few settings to make copy/paste between X11 and Aqua work. Go to X11 -> Preferences... and enable Emulate three button mouse under Input. Next, enable everything under Pasteboard.

    In X11 you copy text by selecting it with the mouse, and you paste by pressing Alt and clicking the mouse.

  9. If you want to be able to add the tags 3 or 4 to a window, you must disable or remap the Cmd-Shift-3|4 shortcuts for utilising the screenshot features of OS X. You can do this under System Preferences -> Keyboard -> Keyboard Shortcuts -> Screen Shots.

  10. I find that the best setup for me is to leave X11 non fullscreen, but hide the dock. This allows X11 and dwm to use almost the entire screen - but leaves the Mac OS menu bar alone.

  11. To get a pile of apps that actually work in X11/dwm, install fink. I've found it to work much better than macports. Using this I have installed and use a number of apps (even FireFox) under X11 - nirvana.


  • After some time you might not be able to open new terminals. This has something to do with permissions, and can be fixed with xhost +. Do you know a permanent solution? (Possibly fixed with one of the settings under X11 -> Preferences… -> Security)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment