Have you ever felt bored because the prompt of your Terminal is not immediately noticeable and you should to wait some moments when opening Terminal in your OS X? Some sources say the length of this process due to the writing of log files in OS X. To expedite the process, you can clean the log files. You can do it manually or by using a little trick. In this post, I will share the trick I mean.
- Open Terminal and enter the following commands (each command line should be ended by pressing ‘Enter’ button):
cd /private/var/log/asl/
ls *.asl - From the second line command, you’ll see some files ending with .asl. If you do not find it, then I believe it is incorrect, repeat the above steps with a more cautious.
- Enter the command below (still you should complete the command by pressing ‘Enter’ button).
sudo rm !$
- Enter your administrator password if asked.
- Quit the Terminal, and note the speed when you load it.
- Now, all you need to know is how to prevent your Terminal became slow again. Read the rest of this post.
How to prevent it?
- Open 'Finder'.
- Click on 'Go' > 'Go To Folder'.
- Type /etc and press the 'Enter' button.
- Find the asl.conf file.
- Use TextEdit to open the file above.
- If you get warn about the privilege, click Unlock.
- In the asl.conf file, go to the last line and enter three lines below:
= archive 0
Explanation:
= utmp_ttl 604800
= fs_ttl 604800
- = archive 0 used to disable archiving the log.
- = utmp_ttl used to sets the time-to-live for message. The number entered as a parameter is in units of seconds. 604800 = 7 days, so after 7 days the time-to-live parameter will be reached.
- = fs_ttl used to sets the time-to-live for filesystem error. The parameter is in seconds too.
- Save the file, enter the Password if asked and close it.
Let's talk why the log makes Terminal running slow.
This is just an opinion, but I think the reason is quite reasonable.
- Terminal will logs every commands entered to the ASLs (Apple System Logs). The ASL will be scanned to make command buffer so you can bring up previous commands by pressing the up/down arrow keys.
- Last Login time stamp: When you open the Terminal, you may see the Last Login time at the top of the Terminal window. We assume that the Terminal scan the log files to gather this info and thus make the Terminal consume more time to scan when the log files grow. When checking the ASL's, this information is stored there.
- The delay in this process does not mean there is something wrong with your Terminal, but it's related to the scanning process of the ASL's file. The Terminal will wait for the scanning process to complete before it displays the prompt.
Are the reasons above quite reasonable? Give your opinions. Hope it useful :)
Via proposedsolution.
No comments:
Post a Comment