There are two problems with screen and the command line
mate , and of course the solution to one brings out the other :)
Apple screen (
This plain and simple wont work. So use MacPorts screen.
MacPorts screen (
/opt/local/bin/screen pr default)
This is where it gets complicated. The latest version of MacPorts screen port, which at time of writing is 4.0.3_3 does not work. It fails with
failed to establish connection with TextMate
which, incidentally, is the exact same error you get with Apple screen.
It has been established that 4.0.3_1 works (bug).
To get that version you need to follow these steps (source)
NB: Do not uninstall the failing version before proceeding, you need to have 4.0.3_3 installed so you can in fact choose to install 4.0.3_1 at the end
Step 1: Set up a local repository
/opt/local/etc/macports/sources.conf and add a line before the last
The path can be anywhere, really, just make sure the directory exists, and that you can somehow write to it.
Step 2: Check out the correct version of the Portfile for screen 4.0.3_1
Make sure you are standing in the directory you created in Step 1, then do
$ svn export --revision 45522 \ http://svn.macports.org/repository/macports/trunk/dports/sysutils/screen/ \ sysutils/screen/
Step 3: Update the portindex, so you can find the old screen version again
If you are still in the directory you created, run
$ portindex .
Step 4: Verify that the port got recognized
To check that we now have two ports, we run
$ port list screen screen @4.0.3 sysutils/screen screen @4.0.3 sysutils/screen
The versions are alarmingly similar, but since you didn't remove 4.0.3_3, you can still pick the right one.
Step 5: Compile 4.0.3_1
$ sudo port install screen @4.0.3_1
This will fail, but in the failing it will tell you what version to deactivate. The fail message will include something like (screen @4.0.3_3+darwin9), which you will need for the next step.
Step 6: Deactivate broken screen 4.0.3_3
$ sudo port deactivate screen @4.0.3_3+darwin9
Step 7: Activate 4.0.3_1
$ sudo port activate screen @4.0.3_1
And if all worked out, you should now be able to use
mate from within screen again :)