Unable to launch application in tmux

Update: This is procedure is unnecessary with tmux >= v2.6

I found a post by Brendon Rapp describing a solution that doesn't require lots of aliases.

$ brew install reattach-to-user-namespace

Add the following line to the end of your ~/.tmux.conf:

if-shell 'test "$(uname)" = "Darwin"' 'source ~/.tmux-osx.conf'

Create a file named ~/.tmux-osx.conf with the following contents:

set-option -g default-command "reattach-to-user-namespace -l bash"
  • The above solution allows the same .tmux.conf file to work correctly under both Linux and OS X. If you only use OS X, you can just add the 'default-command' option directly to your ~/.tmux.conf.

  • If you use a shell other than bash, replace 'bash' with your shell after the '-l' switch.


I had the same problem with tmux and patched it with reattatch-to-user-namespace and shell aliases.

  1. $ brew install reattach-to-user-namespace
  2. $ vi ~/.bash_aliases

    alias subl='reattach-to-user-namespace subl'
    alias stree='reattach-to-user-namespace stree'
    alias open='reattach-to-user-namespace open'
    
  3. $ source ~/.bash_aliases

Not elegant, but works.