DEV Community

Sergey Kislyakov
Sergey Kislyakov

Posted on • Edited on

2 1

Speed up macOS terminal

MacOS does ASL (Apple System Log) log lookup each time you open a tab in the terminal (you can confirm that by running sudo fs_usage | grep 'asl.*login' in a tab and open another one, clear buffer in the first one and open a new tab again to see it indeed does look up each time). There's a way to prevent that though. I'm not sure how important those logs are, the only thing that changed for me was "Last login" disappearance.

iTerm 2:

  1. Open Preferences - Profiles.
  2. Choose your profile (Default by default 😜).
  3. In the "General" tab, change Command from Login shell to /bin/bash (or any other *sh you're using).

You can confirm that iTerm does not lookup ASL logs anymore with sudo fs_usage | grep 'asl.*login' in one tab. Opening tabs should not show output that contain lines looking like private/var/log/asl/2020.01.12.U501.asl, though it may contain something like this:

17:58:04  stat64            /usr/lib/system/libsystem_asl.dylib                                              0.000008   login
17:58:04  stat64            /usr/lib/libsasl2.2.dylib                                                        0.000010   login
17:58:04  stat64            private/etc/asl/.noquota                                                         0.000024   login
Enter fullscreen mode Exit fullscreen mode

That's fine because it does not look up for private/var/log/asl.

Terminal.app:

A bit complicated this time.

  1. Create a symlink of your shell (e.g. /bin/bash) to /usr/local/bin/bash (e.g. ln -s /bin/bash /usr/local/bin/bash). You have to do that because Terminal.app will execute /usr/bin/login which does the ASL lookup if your shell is a default one (default shells are defined in /etc/shells, hence why we link it to /usr/local/bin, because shells in this folder are not defined in the file). Non-default shell will make Terminal.app execute /usr/bin/login -q, and -q skips ASL log look ups completely.
  2. Open Preferences - General.
  3. Change Shells open with to Command and put /usr/local/bin/bash there.
  4. Add -bash (or -zsh or -fish) to Profiles - Basic (Default) - Shell - Ask before closing. This will prevent popups like this when you're trying to close a tab:

Alt Text

You're done, confirm that you don't look up ASL logs using methods I described above.

Image of Datadog

Master Mobile Monitoring for iOS Apps

Monitor your app’s health with real-time insights into crash-free rates, start times, and more. Optimize performance and prevent user churn by addressing critical issues like app hangs, and ANRs. Learn how to keep your iOS app running smoothly across all devices by downloading this eBook.

Get The eBook

Top comments (0)

Billboard image

Create up to 10 Postgres Databases on Neon's free plan.

If you're starting a new project, Neon has got your databases covered. No credit cards. No trials. No getting in your way.

Try Neon for Free →

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay