修改进程终止时间加速mac os关机速度

By | 2013年10月15日

随着十月中旬的来临,除了微软即将正式发布Windows 8.1之外,Apple也将发布Mavericks。在十月的早些时候,Apple已经向开发者发布了Mavericks GM版,相信不少黑苹果爱好者已经迫不及待的安装上了。但不少网友经常会遇到关机缓慢的问题,事实上mac os与Windows一样,在关机时必须等待所有程序结束。如果因为某些后台服务失去相应,则会导致关机缓慢。

在默认情况下,mac os会对超过20秒没有响应的进程执行强制结束。如果同时有几个进程失去响应,则会导致数分钟的关机延时。
大多数情况下,mac os的后台服务通常是导致关机缓慢的罪魁祸首。通过使用控制台命令,可以修改默认的20秒等待时间,使得关机进程更快。
常见导致关机延时的后台服务有:

  • AppleEvents 管理进程间的通讯和操作。当进程间通讯时有进程强制退出可能导致失去响应
  • securityd 管理系统中的密钥链以及授权信息。当等待用户输入时可能会导致失去响应
  • mDNSResponder 管理DNS组播,包括自动发现网络设备。当本地网络配置出现问题时可能失去相应
  • diskarbitrationd 监视以及管理磁盘挂载。如果有磁盘在使用中,或是进入睡眠状态,唤醒该进程将需要一些时间
  • Apple ID authentication 管理Apple ID的认证。可能由于带宽过低或连接问题导致失去相应

要将默认的20秒等待时间更改为5秒,打开应用程序>其它>终端,以此执行以下命令:

  • sudo defaults write /System/Library/LaunchDaemons/com.apple.coreservices.appleevents ExitTimeOut -int 5
  • sudo defaults write /System/Library/LaunchDaemons/com.apple.securityd ExitTimeOut -int 5
  • sudo defaults write /System/Library/LaunchDaemons/com.apple.mDNSResponder ExitTimeOut -int 5
  • sudo defaults write /System/Library/LaunchDaemons/com.apple.diskarbitrationd ExitTimeOut -int 5
  • sudo defaults write /System/Library/LaunchAgents/com.apple.coreservices.appleid.authentication ExitTimeOut -int 5

以上命令执行后立即生效,关机即可查看加速效果。如需要恢复系统默认值,可以执行以下命令:

  • sudo defaults delete /System/Library/LaunchDaemons/com.apple.coreservices.appleevents ExitTimeOut
  • sudo defaults delete /System/Library/LaunchDaemons/com.apple.securityd ExitTimeOut
  • sudo defaults delete /System/Library/LaunchDaemons/com.apple.mDNSResponder ExitTimeOut
  • sudo defaults delete /System/Library/LaunchDaemons/com.apple.diskarbitrationd ExitTimeOut
  • sudo defaults delete /System/Library/LaunchAgents/com.apple.coreservices.appleid.authentication ExitTimeOut

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注

滑动到最右以进行验证 *