{ 9 Intelligent Comments }

OSX Terminal Slow To Launch

Mac OSX Terminal Slow To LaunchTerminal Becoming Slower With Time

Terminal can become unbearably slow to launch and show the prompt after a while.

It’s believed that this is due to an excessive build up of log files in OS X.  This article discusses how to clear those log files and how to prevent it happening in the future.

If you check your console, you will probably see thousands of lines of logs.

You can manually clear your log files and thus improve the launch speed of the Terminal app but the questions I’ve had for many months are:

  1. Why do the log files cause Terminal to slow down so much?
  2. How can I prevent it?

Speed Up Terminal (for now!)

You can clear your log files fairly easily and thus speed up the launch of your Terminal app albeit temporarily by doing the following:

  1. Open Terminal
  2. Perform the following:
    • cd /private/var/log/asl/
    • Press Enter
  3. Enter the command:
    • ls *.asl
    • Press Enter
    • You should see a list of files all ending with .asl.
      • If you do then continue to step 4
      • If you don’t see a list of files ending .asl then STOP – you may have entered something incorrectly.  Start again or post a comment.
  4. Perform the following:
    • sudo rm !$
    • Press Enter.
    • Enter password if requested
  5. Quit Terminal
  6. Launch Terminal – notice the speed difference?
  7. Great, now read on for prevention methods.

Why Do The Logs Slow Terminal?

Well when I started writing this article I was determined to find out exactly why Terminal slows down so much when the ASL (Apple System Logs) files build up but alas I’m left guessing.

Here’s what I think it could be:

  • Terminal logs every command to the ASLs and therefore scans the ASL’s for a command buffer so the user can press the arrow up/down to bring up previously typed commands.  This is however flawed because on searching the ASL files, I cannot find my previously typed commands.
  • Last Login time stamp:  When you open terminal you may notice it shows the Last Login time at the top of the window.  Could Terminal be scanning the log files for this info and therefore slowing down when the log files grow?  On checking the ASLs, this information is stored there!
  • It is not terminal but some other related process scanning the ASLs that terminal is waiting for to finish before showing the prompt.  Possible?

Share your thoughts below and maybe we can crack this thing some day.

For the moment, I’ll give you some ways to keep those logs clear so you don’t have to manually delete them.  Read on for some preventative measures.

Preventative Measures

How often do you look at your system logs?

The answer to that could help you decide how long you want to keep them.  On my system, I’ve configured the system logs to purge every 7 days.  This means problems such as terminal’s slow launch never occur.

Heres how to do it:

  1. Open Finder
  2. Click Go > Go To Folder
  3. Type /etc and hit Enter
  4. Locate the asl.conf file
  5. Open it with TextEdit
  6. You may be warned that root owns the file, click Unlock.
  7. Go to the bottom of the file and enter three new lines as follows:
    • = archive 0
    • = utmp_ttl 604800
    • = fs_ttl 604800
  8. So, you want to know what’s happening right?
    • The first parameter = archive 0 disables archiving.  I like to set this because I have no desire to retain masses of archived versions of my logs.  That’s a zero after the word archive by the way.
    • utmp_ttl sets the time-to-live for messages in seconds.  604800 is 7 days.  Set this to the length of time you would like.
    • fs_ttl is the time-to-live for filesystem errors.  This is in seconds too.
  9. Save the file.  Enter your password is prompted.


Wow, 9 Comments! We've got a conversation going now. Join the discussion below!

  1. Paulo A. Nascimento says:

    Ross, thanks for an excellent article. Effective.
    However I got surprised because I do often run ‘sudo periodic daily, weekly and monthly’ aside those entries being on crontab by default. Going even further sometimes I run things like Yasu or other UNIX command GUI wrappers for clearing logs. Yasu for example promises cleaning a lot of system logs…
    Should known of ALS logs before… 🙁



    1. Rosco says:

      Hi Paulo,

      Thanks for the comment and the reminder of YASU. I used this a long time ago but had forgotten about it!

      Glad this article helped you.

  2. Darren says:

    Your second guess is correct. login is scanning the ASL files to find your last login timestamp so that it can display it for you. Specifically, it calls the getlastlogxbyname() function, which uses the ASL API to query the logs.

    The easiest fix is to set Terminal to use a non-login shell, which will skip the whole business of displaying your last login time.

  3. Jens says:

    Excellent. I’ve searched the web (using a few search engines, not only google), for how to speed up Console.app. -Well, I have the problem, that it is (was!) *really* sluggish, and I could not do anything.
    -But this fixed my problem – and got me a bonus, a faster terminal login. It might sound like a small thing, but it’s been a BIG problem. Thank you very much for sharing!!

  4. Paul Lustgarten says:

    Hurray! Just what I needed, and saved me a call to Apple Care. New tabs/windows had been taking over two MINUTES! And I didn’t even have to restart Terminal – the change was effective on just opening a new tab – which now is effectively instant. Thanks!

Leave a Reply