77

I installed tmux locally (without root priviledges). I also created my .tmux.conf file in my home directory with the following lines:

unbind-key C-b
set -g prefix C-o
bind-key C-o send-prefix

However, tmux does not seem to be sourcing this file (my bind key is still C-b). I have tried closing and re-opening my ssh session (this is on a remote machine) with no success.

What could be hapenning?

1
  • 2
    tmux is not ssh. You need to restart tmux, or manually source the conf file yourself. Restarting an ssh session won't do anything.
    – jw013
    Commented Mar 1, 2013 at 22:22

6 Answers 6

121

It's most likely that you haven't started a new tmux server process. You say that you've closed your ssh session and started a new one, but that wouldn't have any effect on the tmux server; one of the main benefits to using tmux is that sessions can survive that type of activity.

Try running tmux ls to check if the server is still running. If it isn't it should complain about that.

If you instead get a list of sessions, attach to each of those in turn and close them. The tmux server process will die when the last session is closed. Then the next time that you start a new session a new server process will be created and it will read the tmux.conf file.

If you don't want to close the existing sessions you can ask the tmux server to read the configuration file with tmux source ~/.tmux.conf.

1
  • 3
    this saved me a lot of time. I didn't know new setting isn't sourced if there're existing sessions.
    – KFL
    Commented Jul 21, 2021 at 17:54
54

Use tmux kill-server, after that start a new tmux session.

4
  • 1
    you save my day!
    – zx1986
    Commented Jul 20, 2015 at 2:11
  • 3
    But please note that you will lose all open sessions / tab after killing the server. Commented May 8, 2017 at 10:36
  • i get "no server running"
    – chovy
    Commented Dec 19, 2021 at 20:26
  • After this I got server exited unexpectedly when trying to start a new session. Make sure to remove tmux* directories in /tmp
    – paulplusx
    Commented yesterday
36

This can also be done from within tmux, by pressing Ctrl+B (prefix key) and then : to bring up a command prompt, and typing:

:source-file ~/.tmux.conf

Read http://blog.sanctum.geek.nz/reloading-tmux-config/

0

As described in the other answers, if a tmux server process is already running, the configuration file will not be re-read when starting a new tmux session. Here’s the explanation from the tmux manual page:

The configuration file is a set of tmux commands which are executed in sequence when the server is first started. tmux loads configuration files once when the server process has started. The source-file command may be used to load a file later.

0

tmux-256color installation in Apple MacOS X is a bit different from Linux. Here is what needs to be done.

tmux kill-server
brew install ncurses
/usr/local/opt/ncurses/bin/infocmp tmux-256color > ~/tmux-256color.info
sudo tic -xe tmux-256color tmux-256color.info
nvim ~/.tmux.conf
set -s default-terminal 'tmux-256color'

More details:

-2

You need to restart the tmux process do it: ps -axxx | grep tmux kill -9 #process

now start tmux and your .tmux.conf will work

1
  • 2
    Restarting the tmux sessions is exactly what the existing, accepted answer already says to do, though. As you can see from the downvote that's already on the answer, the site's purpose is to collect distinct answers; please make sure yours are different from existing answers. Thanks, and welcome to U&L!
    – Jeff Schaller
    Commented Nov 25, 2018 at 21:51

You must log in to answer this question.

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