Skip to content

Instantly share code, notes, and snippets.

Created February 22, 2010 19:24
  • Star 100 You must be signed in to star a gist
  • Fork 6 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
dwm on os x [work in progress!]

Installing and configuring dwm on OS X

  1. Install XQuartz ( which is the development version of the that ships with OS X, which means it is way more up to date. I have had some weird issues with v. 2.3-something. XQuartz 2.5.0 fixed that.

  2. Install dwm from Homebrew, brew install dwm. This makes a bunch of necessary tweaks to the DWM configuration.

  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'
    exec >>~/.xsession-errors 2>&1
  5. Add the following to ~/.Xmodmap:

     remove Mod2 = Meta_L
     add Mod1 = Meta_L
  6. X11 uxterm is launched as a non-login shell, which is undesirable. To launch uxterm as a login shell, add the following to ~/.Xdefaults:

    XTerm*foreground: white
    XTerm*background: black
  7. Start dwm should start. 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.


  • 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)
Copy link

Extraneous $ in 4.

- $PATH=$PATH:/usr/local/bin
+ PATH=$PATH:/usr/local/bin

Copy link

airways commented Mar 10, 2011

I also had to do the following to get dwm's meta key to work under Snow Leopard:

Create ~/.Xmodmap with the following contents:

clear Mod1
clear Mod2
keycode 63 = Mode_switch
keycode 66 = Meta_L
add Mod1 = Meta_L
add Mod2 = Mode_switch

I also haven't had any success using dmenu - it builds and installs but when started it shows nothing. Any thoughts on getting this to work?

Copy link

airways, I changed it a bit, but basically you need an ~/.Xmodmap, yeah. Gist updated.

Copy link

airways commented Mar 31, 2011 via email

Copy link

I had to set "UXTerm_" instead of "XTerm_" in my .Xresources:

UXTerm*foreground: white 
UXTerm*background: black

Copy link

Can't launch dwm, X11 constantly fails to launch, when I run dwm-launch from terminal it says:

"dwm: another window manager is already running"

Copy link

I've got osx 10.6.7 with XQuartz, standard X11 same thing is happening

Copy link

Managed to launch it but i get this kind of message after running it several minutes:

"X connection to /tmp/launch-QbCIDa/org.macosforge.xquartz:0 broken (explicit kill or server shutdown).
xterm: fatal IO error 35 (Resource temporarily unavailable) or KillClient on X server "/tmp/launch-QbCIDa/org.macosforge.xquartz:0"
xterm: fatal IO error 35 (Resource temporarily unavailable) or KillClient on X server "/tmp/launch-QbCIDa/org.macosforge.xquartz:0"
xterm: fatal IO error 35 (Resource temporarily unavailable) or KillClient on X server "/tmp/launch-QbCIDa/org.macosforge.xquartz:0"
wqas-Mac-mini:~ wqa$
wqas-Mac-mini:~ wqa$ X connection to /tmp/launch-QbCIDa/org.macosforge.xquartz:0 broken (explicit kill or server shutdown).

Copy link

jinnko commented Jun 27, 2011

With a UK MBP keyboard, MacPorts X11 and dwm there's the problem that you can't access the # (hash / pound / numbersign) symbol by default. After much grief trying to map my meta key in different ways within dwm I figured out how to xmodmap the 3 key to behave as expected.

Using "xmodmap -pke" you can see the exact definitions of the keys. In my case the mapping on the 3 key was:

Change this to the following in your ~/.Xmodmap and your # symbol will be on Shift-3. Yes - the third column represents the Mod1 modifier, so it becomes inaccessible. If you need that symbol you can swap it with something else.

Copy link

hi, I also get:
"dwm: another window manager is already running"

how did you made it work?

Copy link

(Trying to subscribe on these comments) I have the same: "dwm: another window manager is already running"

Copy link

@stanislaw @adrian-gierakowski I had the same error message, but logging out and logging in again solved it.

Make sure you don't save the windows when you log out, or else it won't truly restart everything.

Copy link

So matter what I do, I don't get a login shell within X11. It always sees bash 4.0

Copy link

Using ~/.xinitrc.d (not the .xinitrc file) and $USERWM variable seems to be the proper way now. And it solves the "another wm running" problem for me on Mountain Lion. See my (simplified) fork.

Copy link

hey this might be such old topic to discuss but reply back if you have a sec!

  1. Quartz is installed
  2. dwm is installed
    but running dwm is still a problem. I get:

Meysams-iMac:~ meysam$ /usr/local/bin/dwm
warning: no locale support
dwm: another window manager is already running

I'm even not sure if I have my all conf files correctly edited. I used the same post that you used earlier. seems I'm lost a bit!

Copy link

Recently I added terminal app named terminator to homebrew, which is far better than X11 default terminals. hope others to use it.

Copy link

afh commented Jun 22, 2014

I was a bit frustrated not being able to use the mouse buttons 2 and 3 properly with the dwm modifier key mapped to the command key on my system in order to move and resize floating windows, since the Xquartz Emulate three button mouse preference also using the command key interfered with that.

Reading through Xquartz (1) I found that I can remap the modifier keys for the mouse button emulation using:
% defaults write org.macosforge.xquartz.X11 fake_button3 fn

With this the fn key is used to emulate mouse button 3 and the command key is free for proper use with dwm 👍

Copy link

matto80 commented Jul 29, 2014

I shouldn't really talk (haven't got it working yet but...) I had copied my xinitrc from my Archlinux partition, but of course it doesn't work. xinitrc needs to look in ## /opt/X11/lib/X11/xinit/xinitrc.d/ for xinitrc.
I don't know if that will help anybody..

Copy link

"brew install dwm" is not working on OSX 10.10.3:

$ brew install dwm
Error: No available formula for dwm
Searching formulae...
Searching taps...

Copy link

difley commented Jun 21, 2015

Replace brew install dwm with brew install homebrew/x11/dwm if you get the error reported by Xneos128

Copy link

Hi, I've tried installing both dwm and i3 and both are starting fine but I get terrible render performance in the terminal in both wm's. (prints ~5 lines/s). Have tried different terminal emulators same issue. When I run Xquartz normally (without dwm or i3) it works fine in xterm.

I'm running macOS 10.12.3 on a MacbookPro retina 15".
Ran brew install dwm and brew install i3 respectively
only thing I've done after that is to put USERWM=/usr/local/bin/dwm in

Anyone know what the problem might be?

Copy link

rohitbishnoi commented Apr 14, 2020

Getting the following error while executing dwm-launch script on macOS Mojave
xsetroot: command not found

Copy link

mTvare6 commented May 13, 2021

@rohitbishnoi chmod +x the dwm-launch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment