Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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!

@DeSparta

This comment has been minimized.

Copy link

@DeSparta DeSparta commented Apr 25, 2020

Hello I was following the steps to extend my screen login name but the make fails as:
pty.c:38:11: fatal error: 'sys/stropts.h' file not found

include <sys/stropts.h>

      ^~~~~~~~~~~~~~~

2 warnings and 1 error generated.
make: *** [pty.o] Error 1

I was wondering if you could help me fix it?

@4np

This comment has been minimized.

Copy link
Owner Author

@4np 4np commented Apr 25, 2020

Oh wow, I ran into this years ago, but I have never seen this issue in more recent macOS versions. But that might be because my active directory username is shorter than 20 characters these days. What macOS version are you on? Did you try homebrew screen? Perhaps that is already patched?

The pclouds overlay containing the patch seems to have gone away, but it looks like you can find the patch here as well:

https://github.com/pigfoot/gentoo-overlay/blob/master/app-misc/screen/files/4.0.3-extend-d_termname-ng2.patch

This (as well as Apple’s patches) of course only apply to screen 4.0.3 so make sure you checkout the 4.0.3 release before applying the patches.

@DeSparta

This comment has been minimized.

Copy link

@DeSparta DeSparta commented Apr 25, 2020

I'm using MacOS Catalina, version 10.15.4. I tried upgrading the screen via homebrew without success. I found a solution to my problem by using picocom. I was trying to connect to a microcontroller running micropython and picocom was recommended for Linux machines so I tried downloading it via brew and it was there and it works fine.

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