Speed Up Booting, Sleeping, and Waking

In this chapter, I discuss a number of factors that can influence how long it takes a Mac to boot. In addition, I explore an issue that can significantly affect how long it takes for a notebook Mac to enter and exit sleep mode—as well as how much disk space is used.

Learn What Influences Startup Speed

When you turn on or restart your Mac, it has to read thousands of files from your disk, copy a fair amount of data into RAM, and launch a number of processes, most of which run invisibly in the background. Beyond what macOS itself needs in order to function, the process may include loading third-party software of various kinds, such as kernel extensions (which modify the behavior of macOS at a low level) and startup items (often helper apps that run in the background).

Once macOS has started, the login process begins. Depending on your preferences, this may happen immediately and automatically or you may have to supply a username and password to log in. Either way, macOS then loads still more files and runs still more processes, including any items shown in System Preferences > Users & Groups > Login Items.

All of the above could take less than 30 seconds or more than 10 minutes—or anywhere in between. What could account for that tremendous difference in time?

Here are some of the key factors:

  • Disk speed: Because so many files must be read, the speed with which your disk can transfer data into RAM is key. In general, hard disks with lower rotational speeds are the slowest; disks with higher rotational speeds are faster; and SSDs are fastest. And, as hard disks go, external disks tend to be slower than internal disks with comparable specs, and external USB 2.0 disks are crazy slow.

  • Directory health: In this context, directory is the informal term for a set of special files on any disk that keep track of where all the data is. Because any given file may be stored in dozens or hundreds of smaller pieces scattered over the disk, the directory enables macOS to find and reassemble all those pieces (among other functions). Any number of factors can result in a damaged or inefficiently structured directory, which in turn makes it more time-consuming to locate and read the files necessary to start macOS.

  • Caches: Some of the components that macOS must load at startup, including fonts and kernel extensions, are cached to provide faster access. Reading caches is faster than reading all the individual files—unless the caches are damaged (see Clearing Caches). In situations where a cache is outdated or has been deleted, the startup process takes longer, both because macOS must read all the individual files from scratch and because it must also rebuild and write the cache. This may be the case, for example, when you boot from a duplicate for the first time.

  • Startup and login items: Although many startup and login items load almost instantly (especially launchd items that don’t necessarily run apps when they load; see the sidebar Launchd and the Meaning of “Start”), some of these are full-blown apps that can take several seconds or more each to open.

  • Safe boot factors: As I explained in Using Safe Mode, holding down the Shift key when you start your Mac disables a number of things, which sounds as though it should make your Mac boot faster. But because a safe boot bypasses the cache of kernel extensions and also runs a directory check, it takes much longer than a regular boot. In addition, your first regular boot after a safe boot may take a bit longer as caches are rebuilt.

  • System updates: The first time you restart after updating macOS (for example, from 10.13.1 to 10.13.2), the boot process usually takes longer, largely because the caches associated with various updated low-level components must be rebuilt. This is normal; subsequent restarts should proceed at their usual pace.

Speed Up Startups

Although it may be obvious from the foregoing, you can often decrease the amount of time it takes to boot your Mac if you do the following:

  • Upgrade to a faster hard disk or an SSD; see Upgrade Your Hard Drive or SSD and Add an SSD.

  • Make sure your directory is healthy; see Run Disk Utility.

  • Ditch superfluous startup and login items; see Prune Startup and Background Items.

  • Make sure your startup disk is set correctly; if not, your Mac can waste time looking for a nonexistent disk before defaulting to the first valid boot volume it finds. Go to System Preferences > Startup Disk, verify that your desired startup disk is selected, and if not, select it.

Manage or Disable Safe Sleep

All modern notebook Macs have a feature called Safe Sleep. With this feature enabled, as it is by default, macOS saves the contents of RAM to disk when the Mac sleeps so that if, while the Mac is asleep, your battery drains completely, you can return to your previous state quickly (a bit slower than waking up from ordinary sleep, but much faster than a full restart), without losing any unsaved work.

That extra security can be valuable, as can the savings in time over restarting from scratch. But to get these benefits, you must wait longer for your Mac to go to sleep, and sacrifice some disk space too. In Apple’s current implementation of Safe Sleep, putting your laptop to sleep triggers it to save a complete copy of your RAM onto disk: if you have 8 GB of RAM, that means 8 GB of disk space used. Saving this file (/var/vm/sleepimage) delays the onset of sleep by as long as a couple of minutes, depending on the Mac’s configuration—during which time, Apple’s documentation cautions, you must not move your computer. (This warning applies only to mechanical hard drives, by the way—not to SSDs.) This can be terribly inconvenient for people who want to be able to pick up their Mac notebook and go on a moment’s notice.

On the one hand, there are times when a typical user might greatly benefit from Safe Sleep; on the other hand, during periods when you know you won’t need it, it’s preferable to be able to put your Mac to sleep instantly (and save a fair bit of space on your disk).

Apple offers no user interface to enable or disable Safe Sleep, and although you could enter commands in Terminal to switch modes, that’s not very convenient. But thanks to a utility by Patrick Stein called SmartSleep, those of us with Mac laptops that sleep in what we regard as the “wrong” way can tailor sleep settings to our liking with just a couple of clicks.

SmartSleep lets you choose exactly what happens when you put your Mac to sleep:

  • “Sleep and hibernate,” the default, saves your Mac’s RAM to disk before sleeping—but I dislike that, because it takes too long and uses up too much space.

  • “Sleep only” (the default on earlier Mac laptops) sleeps immediately without copying RAM to disk.

  • “Hibernate only” saves the contents of RAM to your disk and then powers down completely.

  • “Smart sleep”—my favorite—dynamically turns “sleep and hibernate” mode on or off depending on your battery’s current charge (the threshold is adjustable with a slider). With this setting, your Mac notebook goes straight to “hibernate” only when your battery’s charge is less than 5% by default.

One thing SmartSleep doesn’t do is delete your sleepimage file, if it exists, once you’ve chosen a mode that doesn’t require it. To do this, open Terminal (in /Applications/Utilities) and enter this command:

sudo rm /var/vm/sleepimage

Press Return and enter your administrator password when prompted.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset