If you use the Terminal on macOS you may have noticed that over time it becomes slow to launch and on opening new tabs. Well, you’re not alone. Thankfully, there’s a really easy and quick solution for this.
It’s as easy as deleting the Apple System Logs. It just takes a few command lines to do it. In my case, it went from about five seconds to instant.
Command To Speed Up Your Terminal
Every new line / command starts with the $ character. Don’t copy it. Thanks Amir for the suggestion to improve the command.
$ sudo rm -f /private/var/log/asl/*.asl
That’s all. And it’s really simple. Basically, it removes all the .asl log files that are in the /private/var/log/asl/ folder.
Now your Terminal will launch instantly. Go ahead and try it.
Important: Be cautious with sudo and rm commands. Always double check that you are running them in the proper directory.
Add an Alias to the Bash Profile
You can also add an alias to the bash_profile of your Mac so it’s much more easier to run this command in the future.
Simply, open the Terminal app and open the bash_profile file.
$ nano ~/.bash_profile
Then, add this to the file
# Clean System Logs
alias cleanlogs="sudo rm -f /private/var/logs/asl/*.asl && echo Cleaned Apple System Logs"
Now you can close and save the changes. Then, reload by closing and opening the Terminal, or running this command.
$ source ~/.bash_profile
And that’s all. Now you’ll be able to simply type “cleanlogs” and hit enter in the Terminal to clean all the Apple System Logs.