Selecting text becomes very slow in terminal app

I use the terminal app a lot. Since I've upgraded to Lion, after running for a few days when I try to select some text to copy and paste, it gets slower and slower and eventually takes a minute or two to copy the text. Terminal just sits there and I can't select another terminal window. The copied text is not in the clipboard yet because if I try to paste into another app the old contents are there. I'm trying to figure out if there's something I do that triggers this or if it's just how long terminal's been running. It seems to be worse with multiple line selects. I often resize windows a lot - very wide to see output lines without wrap and then back narrow for normal output. I have a lot of saved lines per window (10,000). I move the laptop between home and work by just putting it to sleep, and when I plug it into a different size monitor all my open terminal windows come up about 50x100 pixels and I have to resize them back to normal size (that's new with Lion). But none of this is different from how I worked before Lion and it never got slow. When I'm working the delay makes it almost impossible to use copy and paste. If I reboot it's ok again for a while. Anyone else seen this? I've seen posts about the terminal app being slow to open, but this is different. Any ideas? thanks.

MacBook Pro, Mac OS X (10.7.3)

Posted on Mar 10, 2012 9:46 AM

Reply
10 replies

Mar 10, 2012 11:19 AM in response to nscollins

Please read this whole message before doing anything.


This procedure is a test, not a solution. Don’t be disappointed when you find that nothing has changed after you complete it.


Step 1


The purpose of this step is to determine whether the problem is localized to your user account.


Enable guest logins and log in as Guest. For instructions, launch the System Preferences application, select Help from the menu bar, and enter “Set up a guest account” (without the quotes) in the search box.


While logged in as Guest, you won’t have access to any of your personal files or settings. Applications will behave as if you were running them for the first time. Don’t be alarmed by this; it’s normal. If you need any passwords or other personal data in order to complete the test, memorize, print, or write them down before you begin.


Test while logged in as Guest. Same problem(s)?


After testing, log out of the guest account and, in your own account, disable it if you wish. Any files you created in the guest account will be deleted automatically when you log out of it.


Note: If you’ve activated FileVault in Mac OS X 10.7 or later, then you can’t enable the Guest account. Create a new account in which to test, and delete it, including its home folder, after testing.


Step 2


The purpose of this step is to determine whether the problem is caused by third-party system modifications that load automatically at startup or login.


Disconnect all wired peripherals except those needed for the test, and remove all aftermarket expansion cards. Boot in safe mode and log in to the account with the problem. The instructions provided by Apple are as follows:


  • Be sure your Mac is shut down.
  • Press the power button.
  • Immediately after you hear the startup tone, hold the Shift key. The Shift key should be held as soon as possible after the startup tone, but not before the tone.
  • Release the Shift key when you see the gray Apple icon and the progress indicator (looks like a spinning gear).


Safe mode is much slower to boot and run than normal, and some things won’t work at all, including wireless networking on certain Macs.


The login screen appears even if you usually log in automatically. You must know your login password in order to log in. If you’ve forgotten the password, you will need to reset it before you begin.


Test while in safe mode. Same problem(s)?


After testing, reboot as usual (i.e., not in safe mode.) Post the results of steps 1 and 2.

Mar 11, 2012 2:45 PM in response to Linc Davis

thanks for the ideas, but this problem doesn't show up until after many days and the creation and deletion of many, many terminal windows. it's not possible for me to do my job running under a different account, and i have no extra hardware and no software installed on my system that's not on dozens of other work computers just like mine. most of the rest of my group prefers to use X for their terminal windows. i'm the odd duck in that i prefer the fonts and options on the native mac terminal app. so i'm looking for other users who have the same problem, to see what we have in common. it seems to me to be a bug in the app, but maybe it's something that i have some control over (e.g. if X provokes the bug, i'll avoid doing X).

Mar 11, 2012 3:02 PM in response to nscollins

It's not a bug. I routinely leave shell sessions running for a couple of weeks at a time and have no problems. Your system is misconfigured, but if you can't test and can't reproduce the problem it will be very hard to solve. I suggest you check your logs and at Activity Monitor the next time it happens. Look for repeated error messages and abnormally high CPU or memory activity in a process.

Mar 12, 2012 8:01 AM in response to Linc Davis

before the lion upgrade, i had the same experience as you - leaving terminal windows up for weeks worked fine. this is new after the upgrade. but your suggestion about checking the logs was a good one - i found 100s of these messages:


3/7/12 4:38:04.422 PM Terminal: _NXGetScreenRect: error getting display bounds (1001)


that sure looks like a bug to me. what configuration do you think i could possibly be setting that would trigger this?

Mar 12, 2012 1:37 PM in response to nscollins

what configuration do you think i could possibly be setting that would trigger this?


Without the information I asked for, I can't even begin to guess. I get that log message occasionally, but not from Terminal, so I don't know whether it's significant. I assume you know how to move or delete the Terminal preference file. You could try that and see if there's an improvement. Beyond that, it's possible that a third-party system modification you installed is causing the problem.

Apr 9, 2012 1:24 PM in response to Linc Davis

i was able to trigger the slow terminal state by putting my machine to sleep and waking it back up attached to a display with a different resolution. (i moved my laptop from one office to another and the external displays are different.) i almost always keep the laptop lid closed, so the external display is the only one attached. all the terminal windows resized to strange sizes (e.g. wide but only 5 lines tall). in the console log i found:


X11.bin[54631]: kCGErrorRangeCheck: CGSGetNumberOfDisplayModes

org.x.startx[54581]: Unable to determine current display mode.

SystemUIServer[48627]: kCGErrorIllegalArgument: CGSGetDisplayBounds: Invalid display 0x2b285a51SystemUIServer[48627]: kCGErrorFailure: Set a breakpoint @ CGErrorBreakpoint() to catch errors as they are logged.

SystemUIServer[48627]: _NXGetScreenRect: error getting display bounds (1001)

loginwindow[66]: kCGErrorIllegalArgument: CGSGetDisplayBounds: Invalid display 0x2b285a51

loginwindow[66]: _NXGetScreenRect: error getting display bounds (1001)

SystemUIServer[48627]: kCGErrorIllegalArgument: CGSGetDisplayBounds: Invalid display 0x2b285a51

SystemUIServer[48627]: _NXGetScreenRect: error getting display bounds (1001)

loginwindow[66]: kCGErrorIllegalArgument: CGSGetCurrentDisplayMode: Invalid display 0x2b285a51


with the last few lines repeated 100s of times. i will point out that i used to move my machine between these same displays, in the same way, dozens of times before the lion upgrade and never had this problem before. and these are terminal windows, not xterms, so i don't believe that the X11.bin error is the cause. like everything else trying to understand the display geometry, it can't and it's confused along with the apple terminal windows. restarting the machine fixed it. next time i'll try opening the lid of the laptop and have it try to 'detect displays' and see if that resets anything without a reboot.

Apr 9, 2012 3:45 PM in response to Alberto Ravasio

alberto,


thanks for the suggestion. i did this already and it did speed up the terminal startup time (and fixed it for several of my colleagues at work) which was nice! but this slow-down seems like a different problem - it only shows up after the terminal app has been running for a while, and apparently only after i've swapped external displays while it's sleeping.

Apr 10, 2012 1:53 PM in response to Topher Kessler

sure, i've got lots of custom terminal display options selected! but i no longer think this is a terminal bug; i think it's a more general display problem. i saw errors in the system.log file from thunderbird, finder, etc complaining about an invalid display. it seems like something about the entire display isn't getting set right when the mac wakes up, and so none of the apps can figure out what to do. the others seem to recover (or just use their previous geometry info), but when the terminal app tries to cut and paste text, i'm guessing it's confused about the line lengths and is trying to grab huge column counts or something that makes it slow. i'm going to experiment with opening the lid of the laptop to wake it up before i plug it into an external monitor when i have to move offices and use a different display.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Selecting text becomes very slow in terminal app

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.