OSX: Real Cause Analysis and temporary solution for Mac 10.8.2 slow Shutdown

Source: Internet
Author: User
Tags administrator password

Note: If you ignore the word "temporary", you may miss more.


Many people have complained that the shutdown speed of Apple's 10.8.2 system is slow, and no matter what type of Hard Disk (SSD or HHD), the same results will appear, such as here and here. Of course, on Apple's official forum, many people complained about slow shutdown. There is also a survey by a netizen, which shows that this is not a small probability event. This slowness has caused problems for many people.
When leopard 10.6.x, shutdown is very fast, commonly known as the second off. In comparison, the new system is really regrettable. The impact of this problem on Apple fans is not so much a disappointment or annoyance as it is a kind of anxiety. People are used to the smooth running of Apple computers, but all of them are slow and frustrated, as more and more people complain about the Internet, this kind of uneasiness has evolved into complaints. Now it seems that people have been suffering from him, on the contrary, it is quite quiet.


Of course, some people claim to be able to completely solve the problem of slow shutdown. Others are more cautious about sharing their own steps with everyone. If you don't care about it, you can check the RP. For example, here. A variety of methods have been proposed abroad to solve this problem. So far, no solution has been accepted as a complete solution. Everyone is expecting the apple official team to provide a complete and real solution. It is said that Apple will solve this problem in the next 10.8.3, but they seem to be focusing mainly on improving the graphics core, drivers, airplay, WiFi, and other core aspects, let's wait and see.


Currently, the main causes of slow shutdown can be OS X system problems and application software problems. The essential difference between the two is that the former causes the screen to appear after the system exits.Rotary gear"(Spinning gear, commonly known as the infinite chrysanthemum, or even the number of circles, called the 20 circles chrysanthemum, etc.) and wait for a long time, the latter is before the system exits, the process by which the system tries to exit all the programs currently running is more specifically at the time when launchd itself exits (system problems) or before (application software problems ). We cannot give any answers to application questions here, and Apple cannot do anything. We mainly discuss system issues.


Before providing a reliable solution, let's look at how to start with a system problem. When we analyze the ideas for solving the problem, we can find that there are several general ideas, some starting with hardware, such as resetting pram, SMC, and memory; some started based on the previous ideas to solve most of the problems, such as the suggestion to fix permissions and prohibit startup items. Some started with opportunities, such as shutting down wifi. In fact, they are all possible, but none of them grasp a basic and effective method. For troubleshooting, almost all experienced program developers/system administrators will think of the System Log logs. Checking System logs is the Failover tool for troubleshooting, especially at the system level. In fact, some netizens started to pay attention to this aspect, but unfortunately they did not find the focus.

The focus should also be on internal system management. The basic steps for OS X system startup are as follows:

  1. Power-on, boot-Rom initialization.
  2. Boot-Rom post-processing, black screen at this time, power LED light is on, if any error occurs, LED light will regularly flash.
  3. Start to call EFI.
  4. EFI startup: responds to the user's keyboard, such as entering the single-user mode. Normally, the silver Apple logo appears after the boot. EFI is read normally.
  5. Start the kernel: see the gray background and rotating gear. From here, you can find the relationship between processes in the activity monitor program.
  6. Start launchd: the blue screen is displayed. Launchd is responsible for starting and managing various services of the system.
  7. The login window appears:
  8. User Logon: After a user logs on, the system also uses another launchd to enable the user environment for the user, and all the actions of the user after the user (unless in special circumstances ), all under the management of the second launchd.
Now let's start the activity monitor program in the/applications/utilities directory and select all process and hierarchically. For example, we can see the relationship between processes. The core always occupies task id 0, while the first launchd is always Id 1. The user launchd (ID 154 in) is the process sub-process of Id 1.

Since this process is started, exiting/shutting down is an inverse process. First, shut down the user environment, that is, the exit process of the user launchd; then the exit process of the system, that is, the exit process of the launchd of Id 1. Therefore, the reason for slow system shutdown should be the delay caused by the exit delay of a certain/some services that the system is responsible for shutting down launchd of Id 1. After learning about this, we can proceed with the analysis.
How can I find out which service process has exited with a delay? This depends on the log. Open the console program and find/var/log> COM. apple. launchd> launchd-shutdown.system.log, after, in the search in the upper right corner, input timeout, will appear as the screen, change the picture this is after I modified, before the modification, the timeout time of the two services, applevents is 20 seconds, and securityd is 15 seconds.
This finds out the real reason why the system shuts down the odd slow state. After launchd sends a sigkill signal to each service, it can exit only after all services exit. However, due to the timeout of some services, this slows down the overall system shutdown. As to why or under what circumstances the exit exception times out and how to completely solve these services, we have to let Apple's system developers handle them and we cannot fix them, however, we can change its behavior by setting the exit timeout length. This requires a little bit of knowledge about plist files, the specific system (launchd) we will not discuss how to define and interpret plist files in depth, but will only provide methods. If you are interested, you can go to mongo.apple.com to read relevant documents.

To sum up, the most reliable method is to set a short exit timeout (1 or 2 seconds) for each system service that causes an exit timeout ).

Based on the two services found above, one is com. Apple. securityd and the other is com. Apple. coreservices. appleevents. We use the following command to process them.


sudo defaults write /System/Library/LaunchDaemons/com.apple.securityd ExitTimeOut -int 2sudo defaults write /System/Library/LaunchDaemons/com.apple.coreservices.appleevents ExitTimeOut -int 1

If the system asks, enter the current administrator password to complete the command.

Then, after the system is restarted and shut down again, the "second off" can be achieved without the rotation of chrysanthemum.


Of course, the situations of each system are different, and the causes of slowness are different. Therefore, each user needs to deal with the specific situations of their own machines.

If you need help, leave a message and describe the timeout in the console above. I can write a specific Command for you.


Note: In rare cases, the above method may not work.


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.