GNU Screen is a terminal multiplexer, allowing multiple users connecting on the same terminal process and providing detaching and re-attaching functionalities. It also allows splitting a window horizontally and/or vertically, having different terminal processes in each split.
In general, GNU Screen (or simply, Screen) is a very useful tool with a very bad name for a Google search. Most of Linux distributions come with Screen pre-installed, and so does macOS. Though, macOS comes with an older version of Screen, which does not allow vertical splitting of windows. Additionally, the pre-install version in macOS does not have 256 colors enabled. If you want these two features, you will have to built and install a newer screen version yourself. See below how to do it!
- Download the latest stable version of Screen from its official web page
https://www.gnu.org/software/screen/
For example, at the moment of writing this post, I have downloaded, built, and installed version 4.8.0 and the default of macOS is 4.0.3 - Open your terminal. If you are not in your home directory, do
$ cd ~
- After downloading the latest version (I will assume that you downloaded the 4.8.0 version) you will most likely have the file
screen-4.8.0.tar.gz
in your downloads directory. Move that file in your home directory by doingmv ~/Downloads/screen-4.8.0.tar.gz .
- Then, expand the tar.gz file by doing
$ tar -xzf screen-4.8.0.tar.gz
- Go in the newly created directory by doing
$ cd screen-4.8.0
- Then, to configure your built process and use a Screen that can support 256 colors, do
$ ./configure --enable-colors256
But, if you (for some reason) do not want 256 colors support, then simply do$ ./configure
- After configuration is over, built screen by doing (don’t worry about the warning)
$ make
- When the process is done, you will have the executable of screen. Now is the time to put in a standard directory by doing
$ sudo cp screen /usr/local/bin/screen-4.8.0
- Finally, you have to modify your system variables, so when you are calling
screen
on your terminal,/usr/local/bin/screen-4.8.0
will be called. To do this, add the following to your bash_profile (or the corresponding file for zsh)alias screen="/usr/local/bin/screen-4.8.0"
Additionally, I would suggest adding the-e^Eq
following to the above alias, so you will use theCtrl+e
combination instead of the defaultCtrl+a
. This has the benefit that when you are opening Screen inside Screen (e.g. use Screen to connect to a remote server, and open Screen in the remote server), your local Screen will use theCtrl+e
and the inner one will (most likely) use the defaultCtrl+a
. Thus, the alias should bealias screen="/usr/local/bin/screen-4.8.0 -e^Eq"
- Source your bash profile by doing
$ source ~/.bash_profile
- And you are done! You can verify your newly built screen by doing
$ screen --version
where you should haveScreen version 4.08.00 (GNU) 05-Feb-20
for the Screen 4.8.0 version.
If you used the option for supporting 256 colors, then you will also need to make your Screen indicate that it can support 256 colors. To do this, you have to indicate the 256 colors support at your .screenrc
file. See this blog post of mine, for an example of a .screenrc
file.
Enjoy!