Skip to content

Instantly share code, notes, and snippets.

@vangberg
Created February 22, 2010 19:24
Show Gist options
  • Star 101 You must be signed in to star a gist
  • Fork 7 You must be signed in to fork a gist
  • Save vangberg/311377 to your computer and use it in GitHub Desktop.
Save vangberg/311377 to your computer and use it in GitHub Desktop.
dwm on os x [work in progress!]

Installing and configuring dwm on OS X

  1. Install XQuartz (http://xquartz.macosforge.org) which is the development version of the X11.app that ships with OS X, which means it is way more up to date. I have had some weird issues with X11.app 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
    do
      xsetroot -name "`date +"%Y-%m-%d %H:%M"`"
      sleep 5
    done &
    exec /usr/local/bin/dwm
    
  4. Add the following to ~/.xinitrc:

    PATH=$PATH:/usr/local/bin
    xsetroot -solid '#4a525a'
    exec >>~/.xsession-errors 2>&1
    ~/bin/dwm-launch
    
  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 X11.app. 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.

Issues

  • 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)
@afh
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 👍

@matto80
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..

@Xneos128
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...
homebrew/x11/dwm

@difley
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

@antonbasic
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 00-dwm.sh

Anyone know what the problem might be?

@rohitbishnoi
Copy link

rohitbishnoi commented Apr 14, 2020

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

@mTvare6
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