I am attempting to set up multi user screen sessions on Mac OS 10.7.3 and I run into the error Attach attempt with invalid pid(xxx)!.

If set it up as follows:

Initial configuration of system:

Make the proper permisions for the screen command

sudo chmod u+s $(which screen)
sudo mkdir /var/run/screen/
sudo chmod 755 /var/run/screen/

Screen setup

From <user_sharing_screen>

Initialize the screen with specified session name:

screen -S <session_name>

Make the screen multiuser:

C-a :multiuser on
C-a :acladd <user_to_share_with>

From <user_to_share_with> on the same system connect to the shared screen

screen -x <user_sharing_screen>/<session_name>

Then I get the error message Attach attempt with invalid pid(xxx)!

  • 1
    Are you using the stock 'screen'? If yes that would use /tmp/screens as temporary directory for the sessions? This means you can skip the part with creating the /var/run/screen directory. Unfortunately I get the same error message when trying to connect.
    – boretom
    Mar 10, 2012 at 19:56
  • 1
    Have you considered using tmux instead of screen? Active development and you don't have to jump through all those hoops to get it working on OS X. iTerm even has built-in support for it.
    – Ian C.
    Apr 27, 2012 at 13:40
  • I ended up just setting up a server with Ubuntu for everyone to login to.
    – rudolph9
    Apr 27, 2012 at 15:42
  • A workaround could be trying tmux? They have very similar functionality. If you edit the criteria, I could answer in more detail if you are open to alternative software.
    – Ryan A.
    Jul 27, 2012 at 13:39

2 Answers 2


[Update]The screen utility is broken according to a superuser.com post starting from Mac OS X 10.6.

I was able to compile a working version of screen from MacPorts.org. If you're familiar with MacPorts I could provide you with an updated screen x86_64 binary or the source code patch file (changing one line in socket.c).[/Update]

Update2 Add diff of socket.c

--- screen-4.0.3/socket.c   2003-09-08 16:26:50.000000000 +0200
+++ /Users/fluffy/screen-4.0.3/socket.c 2012-03-10 22:58:57.000000000 +0100
@@ -745,7 +745,7 @@
   if (eff_uid == real_uid)
     return kill(pid, 0);
   if (UserContext() > 0)
-    UserReturn(kill(pid, 0));
+    return 0;
   return UserStatus();
  • I'm a homebrew user, is there anything comprable I could use?
    – rudolph9
    Nov 20, 2012 at 18:20
  • You would have to create a brew formula for it. I haven't done one and frankly I don't see me having time for it right now.
    – boretom
    Nov 22, 2012 at 15:30

I created a homebrew fork with the patch shown above and it works for me. To use it, do this:

brew tap stevemadere/homebrew-dupes && \
brew install stevemadere/dupes/screen && \
sudo chown root `which screen` && \
sudo chmod +s `which screen`

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .