Search code examples
sshtmux

Error when opening tmux directly from ssh connection


I try to open tmux automatically when I connect to my office Computer (Mac with macOS Catalina). I found the following solution outlined in a few Answers and a few blog posts:

ssh <hostname> -t "tmux"

When I use this I get following error:

bash: tmux: command not found

I'm confused because I can open tmux once the ssh-connection is established but not directly.


Solution

  • It looks like that tmux installation path is not present in your PATH variable when you ssh.

    Check what is the path for tmux installation on remote machine using which tmux. And verify if you can see that path in the output of following command.

    ssh <hostname> "echo $PATH"
    

    You can either use the full path

    ssh <hostname> -t "/usr/bin/tmux"
    

    or update the PATH settings for non-interactive shell.