Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've just tried installing tmux from source (via installing libevent first). The installation seemed fine, without throwing any obvious error. But when I typed tmux in iTerm2, it returned "command not found". However, there is clearly an executable named tmux in /opt/bin/.

So I am a bit puzzled that whether I have successfully installed tmux on my mac. How do I get it work with iTerm2?

share|improve this question
up vote 1 down vote accepted

When you type tmux in a shell, the shell looks for an executable called tmux in one of the directories enumerated in the PATH variable (it's a colon-separated list of directories). Check if /opt/bin is in your path:

echo $PATH

If /opt/bin is not in your path, then either install tmux in a different directory that is in your path, or add /opt/bin to your path. The usual place to set the PATH variable is in ~/.profile, or in ~/.bash_profile if you have that but no ~/.profile, or in ~/.zprofile if your shell is zsh.

If /opt/bin is in your path, what's happening is that your shell is keeping the path contents in a cache in memory and not noticing the new addition. Run hash -r to rebuild the cache in this shell. Each shell instance builds its own cache, so you won't have this problem in shells that you start after the installation of tmux.

share|improve this answer
when you say install tmux in a different directory, do you mean simply moving the executable from /opt/bin to one of the directories that is on my path? Thanks. – Simon Jan 8 '12 at 17:07
@Simon Yes, or pass a different path for make install (setting whatever variable the makefile uses). Or you can make a symbolic link from /opt/bin/tmux to a directory in your path, but I recommend picking a method that won't require extra work for other software that you'll install manually in the future. – Gilles Jan 8 '12 at 18:10
I'd suggest using Homebrew mxcl.github.com/homebrew for managing command line tools like tmux and others. It handlers installation, updates, removal, etc, and tools are available immediately in the current PATH after installation. – akosma Mar 19 '12 at 7:45

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.