Installing tmux

On Linux, we can download tmux from the system’s package manager. The command on Debian-based systems like Ubuntu is this:

 
$ ​apt-get install tmux

On CentOS- and RedHat-based Linux systems the command is this:

 
$ ​yum install tmux

On Mac OS X, we can install it with the help of Homebrew by using the following command:

 
$ ​brew install tmux

However, the versions of tmux that apt-get and yum provide will be out of date. If we want to use the latest and greatest tmux, then we’ll need to follow the steps to compile it in Installing tmux from Source. But as long as we’re running version 1.7 or newer, the examples in this book will work.

Running tmux on Windows

We can’t run tmux natively on Windows, but we can run it in a virtual machine. Vagrant, which we installed in the Preface, makes it possible to run tmux on Windows in just a few steps. Create a tmux directory, and move into it. Then add a new virtual machine by running these commands:

 
C: mux>​ vagrant box add precise32 http://files.vagrantup.com/precise32.box
 
C: mux>​ vagrant init precise32
 
C: mux>​ vagrant up

Now you can run the following command to log into the virtual machine if you have SSH on your path (you will if you have Git installed).

 
C: mux>​ vagrant ssh

If the ssh command does not work, open either PuTTY or the Secure Shell extension for Chrome, which we also installed in the Preface. Then create a new SSH connection to your host, 127.0.0.1, on port 2222. The login credentials are vagrant for the username and vagrant for the password.

Whether you connected with the vagrant ssh command or a third-party tool, you’ll see this prompt:

 
vagrant@precise32:~$

From here, we can run all of the commands described in this chapter. But as with any native Linux installation, the package manager may not give us the latest version of tmux. If we want that, we’ll need to compile it from source.

Installing tmux from Source

To install tmux from source, we’ll need a GCC compiler. On Mac OS X, install the command-line tools in Xcode by going to Preferences, selecting the Downloads tab, and pressing Install next to the Command Line Tools item.

On Linux, we’ll use the package manager again. The command for Ubuntu is as follows:

 
$ ​sudo apt-get install build-essential

We’ll also need a few libraries tmux depends upon. Install them on Ubuntu with this command:

 
$ ​sudo apt-get install libevent-dev libncurses-dev

Now that we have these prerequisites installed, download the tmux source from the official website with this command on a Mac:[45]

 
$ ​curl -OL http://downloads.sourceforge.net/tmux/tmux-1.8.tar.gz

Or this command on Linux (including a Vagrant box):

 
$ ​wget http://downloads.sourceforge.net/tmux/tmux-1.8.tar.gz

Then untar the archive, compile the code it contains, and install tmux like this:

 
$ ​tar -zxvf tmux-1.8.tar.gz
 
$ ​cd tmux-1.8
 
$ ​./configure
 
$ ​make
 
$ ​sudo make install

Whether you installed tmux from source or from a package manager, check that it’s working by running the tmux command like so:

 
$ ​tmux -V
 
tmux 1.8

Now let’s kick the tires a bit. We’ll explore the basics of tmux in solo mode before pairing up with a partner.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.116.62.168