Skip to content

Instantly share code, notes, and snippets.

@bigeasy
Created April 7, 2012 10:12
Show Gist options
  • Star 19 You must be signed in to star a gist
  • Fork 7 You must be signed in to fork a gist
  • Save bigeasy/2327150 to your computer and use it in GitHub Desktop.
Save bigeasy/2327150 to your computer and use it in GitHub Desktop.
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
Copy link

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
Copy link

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
Copy link

@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
Copy link

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
Copy link

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
Copy link

showing exec: autoreconf: not found on my screen

@Dispader
Copy link

@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