The problem here is potentially a cross-platform issue (I am running a MacOSX Brew-installed tmux with a Brew-installed BASH and bash completion.

When I first installed tmux, a new open window operated exactly like a native linux tmux session with a fully initialized bash environment. Bash completion, in particular, worked.

Lately, bash completion has stopped functioning upon opening a new window. I had the "trivial" workaround of:

$: tmux new -s foo
$: vi 
(from vi)
$: echo "bash completion is now working again"

But, after a few weeks this has qualified a fix.

I see this problem as being an X or Y question: either I fix tmux on MacOSX (and learn how tmux, bash, and bash-completion work under the hood a little bit more),

-- or --

I figure out how to have tmux run vi and send the ":sh" keys to the vi window whenever a window is created.

This latter option is easier on the one hand, but has drawbacks that will cause me to wind back around to solution one: I will have to CTRL-D + SHIFT[colon]q! + CTRL-D every time I want to kill a window (which is often).

My question relates to the first option:

How do I govern or control tmux on start-up and/or window-specific start-up so that I can manually initialize bash and bash-completion with whatever proper (or hackish) fix I need on the mac to restore the typical working order of new tmux windows?

  • 2
    does bash completion work again if you run exec bash instead of forking a shell from vi? how about exec bash -l? i.e. does it make a difference if the shell is a "login" shell?
    – cas
    Jan 7, 2022 at 16:33
  • @cas yes this works
    – Chris
    Jun 30, 2022 at 14:40

1 Answer 1


Set the default shell in tmux explicitly.

set-option -g default-shell /bin/bash

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .