Install tmux on macOS without Homebrew Many people ( including me ) don’t want to use Homebrew. But if you search online for “How to install tmux on macOS” you will found mostly Homebrew descriptions. Brew install tmux After installation, to start tmux run tmux in your terminal window. Tmux Configuration & Prefix key The global configuration file is located at /etc/tmux.conf and the user specific configuration file is located at /.tmux.conf. Installing Tmux is fairly easy, you won’t need to compile anything manually, it’s a world recognized tool and I haven’t met one Sys Admin who doesn’t use it. It’s available on both APT (Debian), Brew (Mac) and RPM (Fedora) repositories. Ubuntu – Debain sudo apt install tmux Mac. For this you have to have Homebrew preinstalled on. Homebrew’s package index. Terminal multiplexer. License: ISC /api/formula/tmux.json (JSON API). Formula code on GitHub. Bottle (binary package) installation support provided for macOS releases.
vim + tmux: A Perfect Match
^ This is the nuclear approach. An alternative way would be to switch back to the old version if tmux with brew switch tmux then gracefully exit out of all of your sessions. Then switch back to the latest version and create new sessions.
tmux is a terminal multiplexer: it enables a number of terminalsto be created, accessed, and controlled from a single screen. tmuxmay be detached from a screen and continue running in thebackground, then later reattached.
Ununpentium who discover. – [tmux manpage]
When I first heard of tmux I just assumed it was a beefed up version of screen.I had used screen many years ago in order to keep an IRC client logged in evenif I was not connected to my shell. At the time I didn’t see much benefit inadding a tool like this to my development environment.
For a long time I heard developers singing the praise of vim and tmux. Hearingabout the release of iTerm2 2.0 and it’s integration with tmux sparked myinterest in tmux and vim once again. I still don’t know exactly how iTerm2 andtmux integrate, but I’m really happy with my workflow with vim and tmux.
I have been using vim+tmux together for a couple of weeks now and there’s nolooking back. If you’re willing to invest a little bit of time to set thingsup, you’ll quickly make up the time with your streamlined workflow.
brew install tmux
brew install macvim --override-system-vim
Download and install iTerm2 (optional)
Out of the Box
Below are some of the most basic commands for interacting with tmux.
Create a session
The first thing you’ll want to do after installing tmux is create a session.
$ tmux new -s gaslight-blog
You can detach from the session at any point by pressing:
You can attach to the session from the command line with:
$ tmux attach -t gaslight-blog
You no longer have to be dependent on your terminal application to create split panes.
I ran into numerous issues when starting out with vim, tmux, iterm2, and macos. My tmux.conf is prettyslim and well documented at the moment and I recommend you check it out.
The main reason that I continue to use tmux is the great integration that canbe achieved with vim+tmux. Prior to using tmux I used MacVim, but if you’regoing to use vim and tmux together you’ll need to use terminal vim.
Perhaps my favorite feature about using vim and tmux together isvim-tmux-navigator. Thisplugin allows you to treat vim and tmux as one a unified session, with theability to seamlessly navigate between vim splits and tmux panes.
Want to learn about the types of products we build?Check out our projects
Ever since switching to Vim as my primary editor, I've been living in the terminal. Discovering tmux felt nothing short of an extreme home makeover.
What is tmux
tmux is a terminal multiplexer. It lets you switch easily between several programs in one terminal, detach them (they keep running in the background) and reattach them to a different terminal.- tmux manpage
Basically, it lets you use different panes/windows in a single terminal, which comes in particularly handy when working on remote servers.
- Top: vim
- Bottom left: run my development server
- Bottom run: for running any commands I need
Start a session
Within a tmux session, to indicate to the terminal, 'Hey, the following shortcut is for tmux', you use the prefix. The default prefix is
Ctrl + a aka
To run a shortcut, you press
For example, to create a new window, you'd press
C-a followed by
This is a great cheatsheet, but here is a summary of some key shortcuts.
- Resize a pane:
C-a + arrow key
- Full-screencurrent pane:
C-a + z(pressing
C-a + zwill toggle back to original size)
- Toggle layout:
C-a + space
Commands are run in the command line outside of tmuxto interact with tmux sessions (i.e create, attach, kill).
To kill an existing named session:
Less (typing) is more
tn name and
tk name are simpler to remember so I use these aliases in my
Don't forget to run
source ~/.bashrc to load the changes.
You can edit your tmux configuration in the
Remap prefix from 'C-b' to 'C-a' to save your fingers.
More intuitive window splitting (I could never remember
'). Alternatives to this are using
for vertical and
- for horizontal.
Vim style pane selection, i.e. use
h to select the Left pane.
Automatically set window title so it's a little bit clearer.
Brew Tmux Config
Show terminal colors. Replace
xterm-256color with the output of running
echo $TERM in your terminal.
You can also make cosmetic changes. Here's an example of my theme:
Don't forget to run
tmux source-file ~/.tmux.conf to load the changes.
Even less (typing) is even more — editing/reloading config files
To save precious storage space in my mental memory and a few more key strokes, I use these aliases in my
.bashrc whenever I'm working with a new config file.
Brew Install Tmux
Now, for one last time, run
source ~/.bashrc to reload these changes then you can start using