GNU/Screen with 256 colours in Mac OS X
Updating GNU/Screen
I use gnu/screen a lot on various Linux machines and like to have 256 colours when running Vim. Unfortunately the build that comes with OS X doesn’t support this so I had to go ahead and build it myself. It’s pretty straight forward.
First thing you’ll need is a terminal client that can actually handle 256 colours. The standard Apple Terminal.app doesn’t. I recommend giving iTerm a try. It also has xterm mouse support.
The next thing to do is compile and install the latest version of gnu/screen. I’ll assume you already have Git installed.
git clone git://git.savannah.gnu.org/screen.git
cd screen/src
./autogen.sh
./configure --enable-colors256 --with-sys-screenrc=/etc/screenrc
make # I got a lot of warnings here, but they don't seem to matter
sudo make install
sudo cp etc/etcscreenrc /etc/screenrc
If everything went to plan you can run screen and should see “+color-256” in the welcome message. To properly test things you can download 256colors2.pl and run that in the terminal. It will draw all 256 colours to the terminal.
Supporting Vim
If you run vim it will complain about the lack of a 256 colour terminal. This is just because the $TERM environment variable is “screen” instead of “screen-256color”. You can set this manually or you can make screen do it for you. To get screen to do it for you simply edit your ~/.screenrc file and add:
term "screen-256color"
You may also want to enable xterm title support. This means your current vim document name will appear in the iTerm tab. For this add the following to your ~/.screenrc:
termcapinfo xterm*|rxvt*|kterm*|Eterm* 'hs:ts=\E]0;:fs=\007:ds=\E]0;\007'
If you find that the xterm titling still doesn’t work in Vim, then you may need to add this to your ~/.vimrc. Note the special characters ^[ and ^G need to be entered using CTRL+v, ESC for ^[ and CTRL+v, CTRL+g for ^G. Don’t enter them literally.
set t_ts=^[]0;
set t_fs=^G
set title
The final test to make sure everything works is to run screen then run vim. The title in your iTerm tab should say “[No Name] – VIM”.
Comments
AWESOME! These instructions worked perfectly for me!
Used iTerm2 (http://sites.google.com/site/iterm2home/), Vim, screen, and Snow Leopard.
Thanks!
Where can I donate to help Japan?
I am just so unhappy by what happened in Japan with the earthquake plus tsunami and I really want to help all of them by donation.
Does any person know an online site or anything which you could donate to help Japan?
How can i give money to support Japan?
I am so sad by what happened in Japan with the earthquake and tsunami and I really want to assist all of them by donation.
Does anybody find out a web site or anything where one can donate to support Japan?
Thanks, finally this worked. Seems OSX still (as of LION) does not ship a 256 color screen, even though Terminal is now 256.
Thanks!
iTerm2 and a rebuild of screen has totally made my day! I can’t believe that Lion didn’t come with these features — I especially depend on screen’s vertical split, and Apple seems to forget that their products have lots of horizontal real-estate!BTW – iterm is now stalled – get at iTerm2 (http://code.google.com/p/iterm2/)
I use OSX Lion 10.7.2 and pulled source code 25 January 2012 as of writing.
After installing the following error appears:
/var/run/utmp: No such file or directory
Screen works, but it’s annoying…
Add Comment