Instantly share code, notes, and snippets.

Embed
What would you like to do?
How to install GNU Screen on OS X using Homebrew.

Installing GNU Screen on OS X in Homebrew

I want to edit in one tab, run what I edit in the other. Typical multi-view stuff. I've used Terminal.app for the last few years. Lately, however, after not long enough, Terminal gets laggy when I switch between tabs.

The stutter between edit and run is annoying, an unnacceptable. One of the major reason I've chosen to work with character based UI is because it is snappy. There shouldn't be a lag while a screen of UTF-8 is rendered in a monospace font.

The lag gets progressively longer, chipping at my productivity with irritation. The only solution is to kill all my Terminals, which essentially kills my flow. Terminal.app won't remember where I was for me. I have to initialize ever tab.

GNU Screen

Back in the day I'd use GNU Screen. GNU Screen gives you different windows that you use keyboard commands to alternate between, but in a single terminal window.

I can't remember all that I did with it, but I developed a lot of muscle memory around it.

There was a lot more to learn about GNU Screen that I didn't learn. You can navigate your scrollback buffer from the keyboard, cutting and pasting. You can detach screen, close your terminal, then open a new terminal and reattach. Screen will be as you left it.

I'd much rather develop muscle memory that I can take with me to Linux. The only thing that Terminal.app gives me is tabs. Screen gives me tabs, keyboard scrollback, split windows, and saved detached sessions.

256 Colors

Sadly, I found that the screen that comes with OS X does not support 256 colors. Starting with this article GNU/Screen with 256 colours in Mac OS X, I built GNU Screen as follows.

git clone git clone git://git.savannah.gnu.org/screen.git
cd screen/src
mkdir -p /opt/etc
mv etc/etcscreenrc /opt/etc/screenrc
./autogen.sh
./configure --prefix=/opt/Cellar/screen/3.6.0  --enable-colors256 --with-sys-screenrc=/opt/etc/screenrc
make
make install
brew link screen

Now I can run screen and see that I have 265 colors.

@hems

This comment has been minimized.

hems commented Jan 11, 2014

just a note, you have "git clone" twice in your "git clone git clone git://git.savannah.gnu.org/screen.git" line

@hems

This comment has been minimized.

hems commented Jan 11, 2014

Also i got "Error: No such keg: /usr/local/Cellar/screen" after running the commands you pointed out

full stdout here: http://pastebin.com/xsDmLJ4f

thanks for posting anyway, i bet its something about OSX version

@snackycracky

This comment has been minimized.

snackycracky commented Feb 19, 2014

@hems: with this script screen should be started with /opt/Cellar/screen/3.6.0/bin/screen and not with /usr/bin/screen
The Command brew link screen is somehow not picking up the new install Dir.

I just used this:

sudo mv /usr/bin/screen /usr/bin/screen.bak
sudo ln -s /opt/Cellar/screen/3.6.0/bin/screen /usr/bin/screen

@zyxue

This comment has been minimized.

zyxue commented Mar 24, 2014

The current version of screen from the github has become 4.1.0 now. It's good and important to know that the default screen shipped by Apple doesn't support xterm-256color.

@FreedomBen

This comment has been minimized.

FreedomBen commented Oct 28, 2014

You may also try using screen-for-osx. This is a relatively recent, stable version of screen that supports vertical splits. All of the Apple patches are pre-applied so you can just build and install.

https://github.com/FreedomBen/screen-for-OSX

@nitin9791

This comment has been minimized.

nitin9791 commented Mar 14, 2016

showing exec: autoreconf: not found on my screen

@Dispader

This comment has been minimized.

Dispader commented Apr 10, 2016

@snackycracky It looks like you've installed the homebrew/dupes version of screen. I'm partial to that, myself.

An alternative to changing around symbolic links within your environment is to put the GNU utilities farther up in your path

export PATH="$(brew --prefix coreutils)/libexec/gnubin:/usr/local/bin:$PATH"

as suggested by Hong Xu's most excellent post, "Install and Use GNU Command Line Tools on Mac OS X".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment