Apple Mac system shutdown is very slow how to solve?

Source: Internet
Author: User
Tags system log administrator password

At present, the main reasons for the slow shutdown can be divided into OS X system itself problems and application software problems. The essential difference between the two is that the former causes the system to exit after the screen appears "rotary Gear" (spinning Gear, commonly known as infinite chrysanthemum, even some people number laps, called 20 laps, etc.) and wait for a long time, and the latter is before the system exits, the system tries to exit all the currently running programs process, More specifically, LAUNCHD itself exits (system problems) or before (application software issues). Application software problems We can't give any answers here, and Apple has nothing to do with it. We are mainly talking about system problems.

Before we give a solid solution, let's take a look at how to start a system problem. When we are going to analyze the way we solve the problem, we can find that there are a few general ideas, some from the hardware, such as resetting pram and SMC, memory and other methods, some based on the past to solve most of the problems of the idea to start, such as the proposed repair authority, prohibit the start of the item is this idea; There are opportunities to touch, such as WiFi. In fact, they are all possible, but have not grasped a basic effective method. For troubleshooting means, nearly all experienced program developers/system managers will think, System log logs, check the system log is a great weapon to troubleshoot, especially the system level. In fact, there is a netizen on the attention from this aspect, but a bit too little to find the point.

1, to grasp the key, but also from the internal management of the system. The basic steps for OS x system startup are this:

-Power on, Boot-rom for initialization.

-Boot-rom after processing, at this time is a black screen, power LED light, if any errors, LED lantern show has a regular flashing.

-Start calling EFI: You will hear the long sound of the thump.

-EFI Boot: Will respond to the user's keyboard, such as entering Single-user mode and so on. Normally, the Silver Apple logo appears when the read Boot.efi is normal.

-Start the kernel: see the gray background and rotate the gears. From here, you can find the relationship of each process from the Activity Monitor program.

-Start launchd: see blue screen at this time. LAUNCHD is responsible for initiating and managing the various services of the system

-The Login window appears:

-User login: After the user login, the system is also using another launchd to open the user's environment for the user, after which, all actions of the user (unless special circumstances), are under the management of this second launchd.

2, now let us Open in the/Applications/Utilities Directory Activity Monitor program, select all process, hierarchically, the following figure, you can see the relationship between the processes. The core always occupies task ID 0, and the first launchd is always ID 1, and the user launchd (ID 154 in the following figure) is the process subprocess of ID 1.

3, since start is this process, then exit/shutdown is a reverse process. Shut down the user environment first, is the user launchd exit process, then is the system exits the process, namely ID 1 launchd exit process. Therefore, the reason for the slow shutdown of the system should be that the launchd of ID 1 is caused by the exit delay of one or more of the services that he is responsible for shutting down. When we understand these, we can begin to analyze.

How do I find out which service process exits the delay? This is going to be the log, open the console program, find/var/log >> com.apple.launchd >> on the left. Launchd-shutdown.system.log, after, in the upper-right corner of the search, input timeout, will appear in the following image of the picture, change this is my revised screenshot, before the modification, two service timeout time, Applevents is 20 Seconds, Securityd is 15 seconds.

4, this found the system shut down the real reason for the slow, launchd to each service after the Sigkill signal, waiting for all the services to exit, before exiting, and because some services out of time, it caused the entire system shutdown slowed down. As for why and how these services appear to exit abnormally timeout and how to completely resolve them, we have to let Apple's system developers handle it, we can't fix it, but we can change it by giving him a time-out to quit, which requires a bit of knowledge of the Plist file, The specific system (LAUNCHD) How to define and interpret plist files, we do not conduct in-depth discussion, only give the method, interested can go to developer.apple.com to read the relevant documents.

To sum up, at present, the more reliable idea is, to each cause of the Exit Timeout system service set a relatively short exit timeout (1 or 2 seconds).

According to the two services found above, one is Com.apple.securityd, one is com.apple.coreservices.appleevents. We use the following command to process them.

sudo defaults write/system/library/launchdaemons/com.apple.securityd exittimeout-int 2

sudo defaults write/system/library/launchdaemons/com.apple.coreservices.appleevents exittimeout-int 1

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

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.