14

OSX 10.6.3 Terminal.app

Am a pretty dedicated screen user. Terminal.app line buffer and/or scroll does not seem to work for me. That is while in screen anything that goes past the top of the frame is gone, can't scroll back to. This seems to work ok in other terminal apps gnome, cygwin. Perhaps this is a shell env, config, or command?

.screenrc:

startup_message off  
autodetach on  
shell -$SHELL  
vbell off  
defutf8 on  
caption always  
caption string "%{= wk}%w"  

I have tried using defscrollback here with different values, but doesn't have an effect.

some .bashrc settings:

set -o physical  
export TERM=xterm-color  
shopt -s checkwinsize  

10 Answers 10

17

In Lion, the default terminal type is different, so you should use this line in your .screenrc instead:

termcapinfo xterm-256color|xterm-color|xterm|xterms|xs|rxvt ti@:te@

1
  • This doesn't work for me :( "echo $TERM" returns "xterm-256color", so I'm sure it's the right terminal value, but no value I provide takes effect.
    – Tim Harper
    Sep 15, 2011 at 22:20
15

In your home directory, put in the file .screenrc the following text:

# Make xterm scrolling work properly with screen.
termcapinfo xterm-color|xterm|xterms|xs|rxvt ti@:te@

Works for Terminal.app too.

3
  • 2
    I know this worked in Snow Leopard, but doesn't appear to work in OS X Lion. Bummer :(
    – Tim Harper
    Jul 1, 2011 at 23:17
  • 1
    This was just what I was looking for - working for me in OS X Lion 10.7.3 with Terminal.app - fantastic!
    – dossy
    Apr 6, 2012 at 16:02
  • Also works for me in OS X Lion 10.7.5 (Note: There is a slight typo in the answer; the file you need to store the command in is ~/.screenrc, that is, in your home directory, in a file named ".screenrc" -- not "screenrc". I've edited the answer now to reflect this.)
    – likethesky
    May 21, 2013 at 5:52
12

I think it should works as well, even more universal:

termcapinfo xterm* ti@:te@

This would be evan more universal. It's legal:

termcapinfo * ti@:te@
1
  • This is the best answer imho. Apr 18, 2014 at 1:12
3

Short answer:

Type crtl-a + [ and use your scroll/arrow keys or pgup/pgdwn. To exit the "scroll-mode" (not the actual name), press Esc

Long answer: This this article about screen's scrollback buffer.

2
  • please comment on the down-vote.
    – lajuette
    Aug 7, 2010 at 8:58
  • Note, this method appears to pause the running process. Which may or may-not be desired
    – cavalcade
    Nov 27, 2015 at 22:07
3

Old thread I realize, but for what it's worth:

If using a correctly-configured iTerm2 on Mac OS X Mountain Lion 10.8.2, it appears it's not necessary to also create/edit a .screenrc file, as per Gareth's helpful suggestion above.

  1. Install iTerm2-1_0_0_20120726

  2. Launch iTerm2 > Profile menu > Open Profiles > select Default > Edit Profile > Terminal tab > Tick ON:

    • Save lines to scrollback when app status bar is present
    • Unlimited scrollback (optional)
  3. Restart iTerm 2 (or start new shell)

  4. Test it: Personally I SSH'd to Ubuntu 12.04.1 LTS on AWS EC2 > started byobu (already configured to use screen, rather than the default tmux) > Scrollback works fine now (plus, iTerm's mo bettah than Terminal anyhow..)

-dk

2
  • That is amazing!!
    – HaxElit
    May 12, 2014 at 17:39
  • @David Keenan So glad you posted this solution!
    – ivan
    Jun 22, 2014 at 20:29
2

I don't know if it's possible to get Terminal's scroll buffer to collect and work with gnu screen's scrollback.

I recommend that you read more about the scrollback within screen itself. You'll need to learn a few new key combinations -- since you're already using screen, I doubt that will scare you off.

With a little help from Google, I found a blog post called Working with the Scrollback Buffer.

I didn't really expect that the scrollback would ever integrate with Terminal.app's buffer. If you switch from one virtual screen to another, what happens to Terminal's buffer? If you disconnect from one machine and reconnect three hours later, your Terminal buffer is long out of sync.

screen is my little window into another server. I like that screen's scrollback buffer persists with the session so that I have access to it from where ever I connect. I like that each screen within my session has its own scrollback buffer.

I think you found this working in gnome and cygwin because screen uses xterm's 'alternate screen' functionality. There's more discussion of this in the first question on this screen faq page.

1
  • thanks, great info. yes, copy mode is very much vim-like, I like. :) Apr 5, 2010 at 22:14
1

I use iTerm 2. There is an option under profiles>terminal which states: "Save lines to scrollback when an app status bar is present". That and putting:

defutf8 on
termcapinfo xterm-color|xterm|xterms|xs|rxvt ti@:te@

in screenrc did the trick for me. Scrolling!

0

If you go to the Terminal menu and select Preferences... then click on the window tab at the bottom there are options for Scrollback, is the radio button for Unlimited selected ?

1
  • unlimited is selected Apr 5, 2010 at 22:15
0

I realize this is an old thread and has been adequately answered, but my reputation isn't high enough to just comment on the appropriate answer. In the vein of this answer, you can just stick the environment variable into the rcfile:

termcapinfo $TERM ti@:te@ did it for me. It's like the referenced answer, but no wildcards.

0

In my case, the issue with the Mac Terminal.app was that my default terminal profile did not declare the terminal as xterm-256color. Changing the value at "Declare terminal as" under the "Terminfo" heading of the "Advanced" tab of my profile settings fixed the issue.

You must log in to answer this question.

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