tmux shell integration change?

187 views
Skip to first unread message

Charles Sprickman

unread,
Aug 18, 2018, 2:21:11 PM8/18/18
to iterm2-discuss
Hi all,

A few releases ago, I noticed that I’d lost my little indicator in my shells that shell integration was working went away. A few things I’ve checked:

- downloaded the newest version
- ensured that it’s being called in my .profile
- sourced the file manually to see if any errors are printed
- found any references to “/bin/bash” and corrected those to “/usr/local/bin/bash” (we’re not all on linux)

Of note, I run iterm2 locally on my Mac, then ssh (with agent forwarding) to my ssh jumpbox which is where I actually run the tmux command. This works great in general and allows me to retain all my sessions across desktop reboots, going to the coffee shop with the laptop, etc. But I’m not even seeing the shell integration indicator on that first ssh hop to my jumphost.

How do I debug this?

Also, anything in the works to make the whole set of shell integration stuff a little more cross-platform? Pretty much all the non-Linux unix variants out there do not have bash installed at /bin/bash…

Thanks,

Charles

George Nachman

unread,
Aug 24, 2018, 1:50:19 AM8/24/18
to iterm2-...@googlegroups.com
I'm not quite sure from your description how tmux is involved here. By default shell integration is disabled when it sees TERM=screen. If you use tmux integration you can set the environment variable ITERM_ENABLE_SHELL_INTEGRATION_WITH_TMUX=1 to allow it to run anyway.

If it's not a tmux-specific issue:

Check your .profile or .bash_profile and make sure the shell integration script is still being loaded. It may be that something in .bashrc loads after it and breaks its use of PROMPT_COMMAND or bash's debug trap, so try removing things from .bashrc to see what's up.

--
You received this message because you are subscribed to the Google Groups "iterm2-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to iterm2-discus...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Charles Sprickman

unread,
Feb 11, 2019, 1:59:14 PM2/11/19
to iterm2-...@googlegroups.com
Resurrecting this old thread because bits of this setup break for me every now and then and I never figure out why…

First, let me just explain how I use iTerm…  I have lots of long-running ssh sessions that I like to keep open regardless of where I am.

- So I run iTerm2 on my laptop (but not tmux)
- I have a host “in the cloud” where tmux is installed (the “jumphost”)
- I ssh (with agent forwarding) to the jumphost
- I run “tmux -CC” (with a wrapper to persist/deal with the auth sock when I disconnect/reconnect)
- I open a ton of windows/tabs ssh’d to various hosts
- I can then freely disconnect/reconnect to this jumphost and re-attach to the tmux session at will

Does that make sense?  I think more commonly you have users that run tmux on their local Mac. That’s handy, but it becomes unworkable under a few situations:

- You take your laptop somewhere to work and you want to resume your session
- Your internet connection has an outage long enough to time out ssh sessions
- You want to move all your sessions from one mac to another (or share them even)

So that’s the how/why…

Questions:

- Currently I’m seeing my tab titles not being set.  Is this still the correct escape sequence to set the title?
  printf "\033];MY_NEW_TITLE\007"
- Is there a way to gather some debug info from iterm? Is there a way I can see what it’s doing when I run the printf (or echo) command and nothing happens?
- Are there special rules about setting titles when in a tmux session? Is there some documentation on what’s allowed/not allowed when running tmux (for example, that “ITERM_ENABLE_SHELL_INTEGRATION_WITH_TMUX” variable)?
- In general, what are debugging options for shell integration and tmux so that I’m just not randomly clobbering a bunch of dotfiles to see where the problem is?
- Do you generally support the scenario above (with the ssh jumphost) or am I just a total weirdo in wanting to always persist a bunch of sessions?

Thanks,

Charles

George Nachman

unread,
Feb 18, 2019, 7:56:35 PM2/18/19
to iterm2-...@googlegroups.com
> - Currently I’m seeing my tab titles not being set.  Is this still the correct escape sequence to set the title?
>  printf "\033];MY_NEW_TITLE\007"

That should work. Ensure Prefs>Profiles>Terminal>Terminal may set window title is on for the tmux profile.

> - Is there a way to gather some debug info from iterm? Is there a way I can see what it’s doing when I run the printf (or echo) command and nothing happens?

> - Are there special rules about setting titles when in a tmux session? Is there some documentation on what’s allowed/not allowed when running tmux (for example, that “ITERM_ENABLE_SHELL_INTEGRATION_WITH_TMUX” variable)?

Only the aforementioned config setting. File an issue with a debug log if that's not the problem.

> - In general, what are debugging options for shell integration and tmux so that I’m just not randomly clobbering a bunch of dotfiles to see where the problem is?

Throw a couple echo statements in $HOME/.iterm2_shell_integration.$SHELL and see what's going on. There are just a few gating flags.

> - Do you generally support the scenario above (with the ssh jumphost) or am I just a total weirdo in wanting to always persist a bunch of sessions?

Yep, that should work.
Reply all
Reply to author
Forward
0 new messages