Every time I launch either iTerm or Terminal after not using it for a few hours, it takes anywhere from 10-20 seconds to return a prompt. The screen is blank, and although I can type I can't actually run any commands.

If I quit either application, subsequent launches (if done relatively soon thereafter) are quite fast. The slowness only seems to occur if the app wasn't running for a few hours.

I'm running OSX 10.5.7 on a MacBookPro. I have the exact same setup on another computer, with no slow downs.

Any ideas how to speed things up again?

link|improve this question
I love how this question is asked and answered by two anonymous users with random numbers. I don't see this pattern that often! :) – Cawas Apr 13 '11 at 15:59
feedback

5 Answers

up vote 18 down vote accepted

Try clearing out your system logs:

$ cd /private/var/log/asl
$ sudo rm -f *

This did the trick for me.

link|improve this answer
1  
(ASL = Apple System Log) – Arjan Sep 28 '09 at 8:55
This is the one that worked. Thanks! – pmaiorana Sep 28 '09 at 13:28
+1. Worked like a charm even though as one of the other answers suggested I have a non-trivial .bashrc. – alesplin Feb 5 '11 at 20:48
2  
As pointed out on OsXDaily, I'd recommend using sudo rm -rf /private/var/log/asl/*.asl instead because it's safer as it 1) only deletes the log files and 2) avoids cding into the wrong directory and removing all files. – Matthew Rankin Feb 24 '11 at 12:34
feedback

From an article I read a couple weeks ago: Slow Opening Terminal Windows

/usr/libexec/path_helper is terribly slow at loading /etc/paths If you remove all the entries in /etc/paths and ensuring that those items are available in your .bash_profile this will resolve the issue. It did for me anyway.

link|improve this answer
Coincidentally someone rewrote path_helper and it's available at: github.com/mgprot/path_helper – Chealion Oct 26 '09 at 19:46
feedback

Am I required a certain reputation to comment on posts? Anyway clearing the system logs did it for me as well, thanks. I have tried to patch path_helper with the patch here: gist.github.com/123525, as suggested in a comment on http://mjtsai.com/blog/2009/04/01/slow-opening-terminal-windows/ (referenced earlier in this thread) but to no avail. I get a cryptic error. However, that patch should speed up terminal.app launch.

addition: As I mentioned, clearing the logs did the trick for me, but the problem continues to emerge as the logs continously grow bigger after I've removed them. I found that "tweaking" /etc/asl.conf has given me a more permanent solution. The modification is to log only messages that are categorised as "critical" or more critical than that, as opposed to logging "notice" category and every more critical than that. Also, I disregard messages from ftp, mail, local0, local1. Here's a paste of my /etc/asl.conf:

 ##
 # configuration file for syslogd and aslmanager
 ##

# redirect com.apple.message.domain to /var/log/DiagnosticMessages
? [T com.apple.message.domain] store_dir /var/log/DiagnosticMessages exclude_asldb

# authpriv messages are root/admin readable
? [= Facility authpriv] access 0 80

# remoteauth critical, alert, and emergency messages are root/admin readable
? [= Facility remoteauth] [<= Level critical] access 0 80

# broadcast emergency messages
? [= Level emergency] broadcast

# save kernel [PID 0] and launchd [PID 1] messages
? [<= PID 1] store

# save everything from emergency to notice
#? [<= Level notice] store
? [<= Level critical] store

# save lpr info level and above
#? [<= Level info] [= Facility lpr] store

# save all mail, ftp, local0, and local1 messages
#? [= Facility mail] store
#? [= Facility ftp] store
#? [= Facility local0] store
#? [= Facility local1] store
link|improve this answer
Welcome at SU. Yes, 50 reputation is needed, but there's more to know, so head over to superuser.com/faq right away! ;-) – Arjan Sep 28 '09 at 10:38
feedback

If the terminal application has loaded but you don't have a prompt yet then it's your shell taking a while to initialise.

This probably means you have too much or something time consuming in your .bashrc (assuming you use bash).

link|improve this answer
This might be the problem I'm having, do you know how I can check If I'm using bash where I can access the .bashrc file? – alvincrespo Oct 25 '11 at 13:45
feedback

My guess is that over time, something is using a lot of memory. When you startup a terminal after not using it for a while, some memory has to be made available by swapping its contents out to disk. If you kill the terminal process and restart it relatively quickly the memory is still available and it starts up quickly. This should happen with other applications as well.

You should monitor your memory usage with Activity Monitor and see if you can tell where it is going.

link|improve this answer
He said that the Terminal window was open which means the process has loaded. – Mike McQuaid Aug 30 '09 at 10:52
1  
@Mike, I am not sure that once the Terminal window is shown, everything has loaded? Still, if the above would be true for Terminal, then any program would launch slowly. I don't think Terminal needs a lot of resources (6.5/31.7 real/virtual on my Mac), so @pmaiorana: how much memory does Terminal needs on your Mac? – Arjan Sep 28 '09 at 8:52
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.