When I resize a terminal window containing a tmux session, tmux doesn't detect this change, but continues to function normally within the old window boundaries. tmux ls shows no other attached clients before I attach:

$ tmux ls
admin: 1 windows (created Mon Apr 27 15:12:58 2015) [272x75]
apt-runs: 3 windows (created Mon Apr 27 15:17:50 2015) [272x75]
lal-dev: 4 windows (created Tue Jun  9 12:24:25 2015) [238x73]

This only happens with a particular host (running tmux 1.9a), and detaching/reattaching fixes the issue (until the window is resized again). What might be causing this?

Before resize: Before

After resize: enter image description here

  • 3
    Is there another terminal window attached to that session that limits the size? – Anthon Jun 16 '15 at 11:06
  • @Anthon Nope – tmux ls shows no other clients. I've clarified this in the question. – Will Vousden Jun 16 '15 at 11:17
  • I'm experiencing this issue; Noteworthy is that we're both on OSX although I'm probably running a more up-to-date version. Have you found any fix, seeing as there is no accepted answer? – SidOfc Sep 19 '17 at 14:45
  • I'm still seeing this in 2020. Issuing resize in the shell running in tmux resolves the problem, until the terminal window is resized again. This is slightly different from what @saterHater said below. He seemed to suggest that you need to detach tmux before issuing this command. – Tom Ellis May 8 '20 at 19:31
  • This issue seems relevant: github.com/tmux/tmux/issues/359. Also, I should point out that I am running xmonad, which is perhaps as unfamiliar a window manager to tmux as MacOS is. – Tom Ellis May 8 '20 at 19:46

The easiest thing to do is to detach any other clients from the sessions when you attach:

tmux attach -d

or short

tmux a -d

Alternately, you can move any other clients to a different session before attaching to the session: https://stackoverflow.com/a/7819465/1069083

  • 1
    Like I said in the question, there were no other clients. Unlike this case, when there are multiple clients with different terminal sizes, the status bar remains at the bottom of the screen, and the unused area is filled in with dots. I never solved this problem, but I no longer work on the system where it occurred. – Will Vousden Jul 18 '18 at 9:19

I'm not well-versed in terminal lingo, but I managed to get-rid of this bug by doing the following steps:

  1. leave the session by pressting Ctrl+b d (don't worry, you can return to the session completely intact)

  2. Check if your console application is running xterm. If echo $TERM returns xterm then this procedure might work for you.

  3. type resize into your terminal.

  4. return to your session by re-invoking tmux. As you can see, all of your sessions are running like you never left tmux at all.

Tmux links it's terminal size with your xterm 'size' variable. If you happen to have your $TERM set to screen, then I can't help you, since I don't know what the commands are for that TERM session.

  • 1
    Going that route, you'll have to do this each time you resize the window. That's exactly what OP stated they did, in the question. – Thomas Dickey Aug 5 '16 at 20:19
  • 1
    Invoking resize (after apt install xterm) was the crucial step I was missing. – ulidtko Sep 27 '18 at 14:19

This can happen when tmux's window-size option is set to manual. To unset the option, you can press Ctrl+B and type

:set-option -u window-size

window-size is a per-window option, so you will have to run for every mis-sized window in your session.

From tmux's man page:

window-size largest | smallest | manual | latest: Configure how tmux determines the window size. If set to largest, the size of the largest attached session is used; if smallest, the size of the smallest. If manual, the size of a new window is set from the default-size option and windows are resized automatically. With latest, uses the size of the client that had the most recent activity. See also the resize-window command and the aggressive-resize option.

The default is latest as of tmux 3.2 (released Feb 3rd, 2020), or smallest on earlier versions, where latest didn't exist. Notably, however, using iTerm2 with tmux Control Mode will set it to manual without asking you, and that setting will stick around even after detaching iTerm2 and connecting in non-Control Mode with a different client. Other terminal emulators supporting Control Mode likely behave the same way, but I've only tested iTerm2.

  • 1
    This should be the answer. Unsetting the window-size option worked for me. Which makes sense; if tmux gets into the state where it won't resize to the terminal window, and no other session is attached, it's because it's window-size is set to manual. – Jimmy Schementi Oct 24 '20 at 16:36
  • I tried this solution (when my tmux window didn't resize after detaching and reattaching from a larger terminal). When I used the ":" command to run "set-option", my tmux window resized itself when presenting the ":" bar at the bottom. Go figure. – qneill Jan 13 at 19:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.