Skip to content

Instantly share code, notes, and snippets.

@4np
Last active February 24, 2022 16:55
Show Gist options
  • Save 4np/5111826 to your computer and use it in GitHub Desktop.
Save 4np/5111826 to your computer and use it in GitHub Desktop.
GNU Screen for Mac, patched to allow long loginNames

GNU Screen is a virtual console multiplexer, and it has long been available on Mac. However, it was developed with login names of 20 characters or less in mind. Nowadays it is possible that login names actually exceed the 20 character limit (for example when using Active Directory), resulting in Screen quiting with the nice error message LoginName too long - sorry and rendering Screen useless on these Macs.

Below are the steps to download, patch and compile screen yourself to allow login names of up to 255 characters.

$ cvs -z3 -d:pserver:anonymous@cvs.savannah.gnu.org:/sources/screen co screen
$ cd screen/src
$ curl "https://raw.github.com/pclouds/pclouds-overlay/master/app-misc/screen/files/4.0.3-extend-d_termname-ng2.patch"|patch
$ for x in Makefile.in config.h.in configure process.c pty.c screen.cc windows.c; do 
  curl "http://www.opensource.apple.com/source/screen/screen-16/patches/${x}.diff?txt" | patch
  done
$ ./configure --enable-colors256 --prefix=/opt/local --with-sys-screenrc=/opt/etc/screenrc
$ make
$ sudo make install

As this will install the patched Screen in /opt/local/bin and /opt/local/etc (make sure you update your PATH by adding the following line to your ~/.profile (which should already be there if you have MacPorts installed):

export PATH=/opt/local/bin:/opt/local/sbin:$PATH

Removing your self compiled GNU Screen is easy: just remove /opt (given that you have nothing else installed there, like packages installed using MacPorts) and remove the above PATH line from your ~/.profile.

note that XCode and XCode command line tools are required!

@wan721
Copy link

wan721 commented Feb 24, 2022

I recently ran into this problem. My username is 23 characters long and I couldn't change my username because it's a company's laptop. I was able to fix it by using the homebrew screen. Just to be sure, after you install the homebrew screen. Check the order of your $PATH and make sure that the homebrew bin directory comes first. You might need to exit your current terminal session and open a new one to see that it actually picks up the new one installed by homebrew.

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