You’re working away in iTerm using tmux when suddenly, you realize you can’t scroll up using your mouse. This scenario is all too common for tmux users. This article dives into resolving this pesky issue, providing you with a detailed troubleshooting guide to regain smooth scrolling functionality.
Enabling mouse mode in tmux is valuable for easier navigation and selection within panes, windows, and text, enhancing overall efficiency. Here’s a step-by-step guide:
Check mouse mode status:
Open tmux and press Ctrl+B
followed by :
, then type show-options -g mouse
and press Enter. If the output is mouse on
, it’s already enabled.
Enable mouse mode:
If not enabled, press Ctrl+B
followed by :
, then type set -g mouse on
and press Enter. This activates mouse support.
Make it permanent:
Open your tmux configuration file, usually located at ~/.tmux.conf
, with a text editor like nano
or vim
. Add the line set -g mouse on
to the file. Save and exit the editor.
Reload tmux configuration:
Inside an active tmux session, press Ctrl+B
followed by :
and type source-file ~/.tmux.conf
, then press Enter.
Your tmux should now support mouse interactions, making your terminal experience smoother.
Open iTerm2 and go to Preferences.
Navigate to the Advanced tab.
Search for “scroll” in the search bar.
Check the box for “Double-report scroll wheel events to work around tmux scrolling bug”.
In iTerm2 Preferences, go to Profiles > Keys.
Under Key Mappings, search for “Scroll Wheel”.
Ensure “Scroll Wheel sends arrow keys when in alternate screen mode” is enabled.
Open your .tmux.conf
file and add the following lines:
set -g mouse on set -g mouse-utf8 on
Restart tmux to apply the changes.
These settings should help ensure smooth mouse scrolling within tmux sessions in iTerm2.
Keeping tmux and iTerm updated is crucial for several reasons. First, updates often include important security patches that protect your system from vulnerabilities. Second, updates can bring new features and improvements that enhance your user experience.
Third, staying current ensures compatibility with other software and system updates, preventing potential conflicts and issues.
Open Terminal: Launch your terminal application.
Check Current Version: Run the command tmux -V
to check the currently installed version of tmux.
Update tmux: If an update is available, you can update tmux using Homebrew with the following command:
brew update brew upgrade tmux
Verify Update: Run tmux -V
again to confirm that the version has been updated.
Open iTerm: Launch iTerm on your macOS.
Check for Updates: Go to iTerm’s menu bar and select iTerm2
> Check for Updates
.
Download and Install: If an update is available, iTerm will prompt you to download and install it. Follow the on-screen instructions to complete the update.
By keeping tmux and iTerm updated, you ensure that you have the latest features, security patches, and compatibility improvements, making your terminal experience more efficient and secure.
Open iTerm2.
Go to Preferences.
Select the Advanced tab.
Ensure the option Scroll wheels send arrow keys is set to Yes.
Open a new terminal window and start a tmux session.
Add the following line to your ~/.tmux.conf
file: setw -g mouse on
.
Restart tmux to apply the changes: tmux source-file ~/.tmux.conf
.
Test mouse scrolling within the tmux session.
tmux show-options -g mouse
and press Enter.tmux set -g mouse on
to activate mouse support.set -g mouse on
to your tmux configuration file (~/.tmux.conf
) and save it.tmux source-file ~/.tmux.conf
.set -g mouse on
and setw -g mouse on
to your tmux configuration file (~/.tmux.conf
) and restart tmux.