Running Karma and Chrome under tmux on OSX.

If you’re building Angular.JS apps, you’ll probably be using the excellent Karma test runner. I’ve been running into some troubles getting Google Chrome to work when using tmux on OSX. Here’s how to fix it.


The problem
I’m a fossil, I don’t use fancy new IDEs. My tools of trade, which have served me well for years now are tmux and vim. Tmux is like screen, but more powerful. It allows me to split my terminal into panes and have bash next to vim. Awesome.

Screen Shot 2013-07-04 at 12.00.23

Things go wrong when you start using the Karma test runner with Google Chrome.

You’ll be greeted by this guy:

Screen Shot 2013-07-04 at 11.58.35


The solution
Chrome crashes on any page, so this really doesn’t have anything to do with Karma (it just manifests itself there, because it launches a completely new Chrome instance). Turns out the daemon model of tmux is the problem here: tmux runs detached from the GUI, which means Chrome can’t find a screen to paint on.


There’s an easy fix!

  1. Get Homebrew, if you don’t already have it.
  2. brew install reattach-to-user-namespace
  3. Add the following line to your .tmux.conf file: set-option -g default-command "reattach-to-user-namespace -l bash"


Start a new tmux server and everything should work again.


Credit to

Posted: July 4, 2013 19:17 Tags: angular karma tmux chrome