macOS 101: Reduce Data Usage, Increase Speed with Content Caching

Content Caching is one of the new services available in macOS High Sierra. Designed to reduce Internet data usage and increase the speed of updating Macs, iOS devices, and Apple TVs, Content Caching can also speed up iCloud storage by keeping a local copy of the iCloud data on your local area network.

Content Caching: History
Content Caching was originally one of the services included with Mac OS Server. By using the caching service, a system administrator could designate local storage as a repository for all of the software updates distributed by Apple for its various product families.

This allowed all devices connected to the local network to access the stored information without having to re-download the data from the Internet every time a device needed an update.

Caching was an effective way for administrators to reduce the Internet bandwidth used, while actually increasing overall system update performance for the end user.

(Content, such as macOS updates, is cached, allowing others on your network to enjoy faster updates.)

Apple ceased development of the Mac OS Server product, but the Content Caching capabilities have made the migration from the server product to the Mac, as long as it’s running macOS High Sierra or later.

Content Caching: How It Works
Once Content Caching is enabled on a Mac, it keeps copies of all of the software updates, App Store downloads and updates, and iCloud data, including backups to iCloud that are initiated by any client connected to your local network.

The next time a client on your network needs to download the same data, such as a macOS update, the data is retrieved from the content cache instead of being downloaded from the Internet. All subsequent client devices that need the data get it from the local network at what will normally be a much faster connection than is possible from the Internet.

Data Types That Are Cached
Not everything that is downloaded from the Internet is cached. Content Caching supports the following data types:

  • iTunes purchases (iTunes 11.04 and later)
  • iBooks Store content (iOS 6 or OS X Mavericks and later)
  • iOS app purchases and updates
  • iOS updates over the air (iOS 7 and later)
  • macOS updates
  • Mac App Store purchases and updates
  • GarageBand downloadable content
  • iCloud photos and documents for OS X El Capitan or iOS 9 and later
  • Apple TV apps and updates
  • iOS 10 and tvOS 10 On-Demand resources
  • iTunes U course material
  • Mobile assets, including high-quality Siri voices and dictionaries

Setting Up Content Caching
To make use of Content Caching, you’re going to need:

  • A Mac that is on 24/7, or at least whenever a client device is connected to your local network
  • A Mac connected to your local network via wired Ethernet (preferred) or Wi-Fi
  • A Mac with either a large amount of free space on the startup drive or an external drive
  • macOS High Sierra or later

Note: Apple recommends that the Mac being used for caching be hard-wired to your Ethernet network using Gigabit Ethernet or better. The caching system can serve hundreds of clients concurrently. To ensure adequate throughput, a high-performance wired Ethernet connection to the Mac is encouraged.

If you’re implementing Content Caching for your home or small business, with a limited number of client devices (Macs, iPhones, iPads, iPod Touches), a Wi-Fi connection may be adequate, though the caching Mac may see some negative performance effects if the cache is undergoing heavy use.

(The Content Caching controls can be found in the Sharing preference pane.)

How to Enable Content Caching on a Selected Mac
On the selected Mac, launch system preferences by selecting System Preferences from the Apple menu, or by clicking its icon in the Dock.

Selected the Sharing preference pane.

In the Sharing preference pane, select the Content Caching item in the sidebar (do not place a checkmark in the Content Caching box at this time).

If you wish to cache iCloud content, such as photos or documents, place a checkmark in the Cache iCloud content box.

Note: iCloud content is always sent, stored, and received using encryption. The cached iCloud content will also be encrypted.

If you have clients, such as iOS devices, that connect to a Mac using USB, you can have them share in the caching, as well as connect to the Internet via the Mac, by placing a checkmark in the Share Internet Connection box.

Click the Options button.

(Content Cache options allow you to limit the size of the cached data as well as select the drive to house the cached information.)

In the Cache options panel you can select where the content cache will be stored. The default is the Mac’s startup drive. If you wish to change locations, click the Edit button.

A dropdown pane will appear, listing the current storage volumes mounted on your Mac. Select the drive you wish to use, and then click Move.

If you had previously been caching content, content caching is stopped, and the existing cache is moved to the new location. Otherwise, a new location is made ready for use.

Use the slider to set a size for the Content Cache. Selecting Unlimited will allow the cache files to fill the selected drive.

Click the OK button after you set the content cache location and size.

Once you have the options set, you’re ready to start using the Content Cache.

In the Sharing sidebar, place a checkmark in the Content Cache box.

After a short time, the content caching indicator will turn green.

(You can change the default location of the Cached data from your startup drive to any drive connected to your Mac.)

How to Disable Content Caching on a Selected Mac
Bring up the Sharing preference pane.

In the Sharing preference pane’s sidebar, remove the checkmark from the Content Caching item.

After a short time, the Content Caching indicator should turn orange, and then turn off (become transparent) completely.

Advanced Content Caching Options
The Content Cache system has a wide range of additional controls that aren’t available from the Sharing preference pane. To make use of the additional controls, you’ll need to use the Terminal app and two different commands.

Launch the Terminal app, located at /Applications/Utilities.

In the Terminal window that opens, enter the following at the command prompt:

sudo AssetCacheManagerUtil <command>

where <command> is one of the commands listed below. As an example, to find out if the cache is currently running:

sudo AssetCacheManagerUtil isActivated

Press enter or return.

(Using Terminal, you can gain a bit more control over the Content Cache service. In this example, Terminal is being used to check if the cache service is disabled.)

You can use any of the following commands. The commands are case sensitive.

  • flushCache – Flush all cache content.
  • flushPersonalCache – Flush personal iCloud content in the cache.
  • flushSharedCache – Flush shared (non-iCloud) content in the cache.
  • reloadSettings – Reload cache settings (used after a change is made to any cache setting).
  • status – Get current status of cache.
  • settings – Get current cache settings.
  • isActivated – Is the cache currently enabled?
  • canActivate – Can the cache be activated?
  • activate – Enable the cache. (This is functionally the same as turning the cache on from the Sharing preference.)
  • deactivate – Disable the cache. (This is functionally the same as turning the cache off from the Sharing preference.)

The remaining commands use the ‘default write’ command to modify the Content Cache plist. Using any of the following commands will require you to stop and start the Content Cache service before the changes take effect. You can use the Sharing preference pane to turn the service off and back on, or the reloadSettings command listed above.

At the Terminal prompt, enter the following:

sudo -u _assetcache defaults write /Library/Preferences/com.apple.AssetCache.plist <parameter> <value>

Where <parameter> is one of the plist items listed below, and <value> is what you wish to change. An example using AllowCacheDelete:

sudo -u _assetcache defaults write /Library/Preferences/com.apple.AssetCache.plist AllowCacheDelete Yes

You can change the following parameters:

  • AllowCacheDelete – Allow content in the cache to be purged automatically when space is needed. Value can be Yes or No. The default is Yes.
  • ImportMaxRate – The maximum number of bytes per second a client can send data to the cache. A value of zero indicates an unlimited rate. The default is zero (0).
  • ImportMinRate – The minimum number of bytes per second a client must be able to maintain while uploading data to the cache. The default value is 2000.

Troubleshooting
One of the most common problems seen in trying to get the Content Cache operating is the status indicator in the Sharing preference pane never changing from orange to green. This can indicate a corrupt cache that needs to be flushed (see commands listed above), or if you selected an alternate location to store the cache, the failure of the cache to be copied to the new location, or for the file structure to be properly created on the designated volume.

This was a prominent issue in the original release on macOS High Sierra, but the issue has been corrected by macOS High Sierra 10.13.3. If you’re experiencing this issue, Apple recommends upgrading your copy of macOS High Sierra.


LEAVE A COMMENT


  • Ths is essentially the same caching server that shipped with macOS server product, just now available to any client Mac running 10.13. The way it works is the Mac hosting content caching registers itself with Apple’s upstream server as a local content provider for that Mac’s subnet. If another Mac on the same subnet contacts the Apple server for content, it will be redirected to the local caching server which will provide that content, downloading it first if needed. There’s no pre-caching involved. Some Mac on the local network will need to make the request before any transfer is initiated. Unlike the server product’s Software Update Service, client Mac’s don’t need any changes to work with the caching service, but must be on the same subnet as the Mac hosting content caching to participate.




  • Hi Tom…can you verify that caching services does not do any pre-emptive downloading? I’ve got my Mac Mini setup with caching on and my other 2 laptops and 4 iOS devices seem to be getting updates via the cache due to quicker downloading on the second and later device. The macOS App Store is set to not download anything but security stuff. We live in our RV full time and have sometimes unlimited campground internet but sometimes we use either metered campground or our Verizon MiFi device and I want to make sure that we don’t accidentally over download on metered connections. From what I’ve read only downloads that are otherwise requested are cached…but my recollection from looking at the bandwidth usage on my router is that the Mini is using more bandwidth now than before I enabled caching. I figure you might have some more details on pre-emptive downloading…could not find an answer on Apple.com or via google. Thanks.




    • Hi Neil,
      As far as I know, the content cache running on a Mac does not accept pushed downloads from the various Apple services. However, Macs and iOS devices can be configured to accept a pushed update automatically, and this would cause the content cache to be updated with those downloads.
      Apple has a support document for how to turn on automatic downloads for all their services, including iTunes, iBooks, and the App Store. You can use the same document for information on how to turn downloads off: https://support.apple.com/en-us/HT202180

      Tom N.




      • Thanks Tom…that’s about what I thought. I’ve turned off automatic downloads on everything except for the System Data Files like the autoprotect stuff. I’ll have to monitor things a bit longer to make sure that I didn’t miss anything.




  • More specifically, don’t you need to execute the following, or similar, on the client Macs?

    sudo defaults write /Library/Preferences/com.apple.softwareupdate CatalogURL swupd.macmac:8088/




  • Don’t the client Macs have to be pointed at the cache server to use it?




  • I have found this service to be totally unreliable. Sometimes works sometimes doesn’t.

    Will cache but not serve.
    Will randomly decide which of my Macs to recognize.
    Will randomly decide to only serve some Macs.
    Will serve a Mac today, totally ignore it another.
    Never works when you really want it for large apps.
    Rarely actually does its job.




    • Nor ready for prime time? Seems to apply to High Sierra in general. That said, if they ever get it fixed, it may be an essential service for some people, particularly small businesses, not that OS X server is kaput. And it’s certainly easier to administer than a server. Apparently it’s another good idea Apple released too soon. Haste makes waste.




      • Actually, when this was part of Server back on El Capitan it seemed to work flawlessly. Then Sierra botched it up at some point and the removal from Server completely and pushing it into High Sierra didn’t fix it.

        What is even worse, all people can say is “It works for me” and when it doesn’t, no one has any clue whatsoever as to what is wrong.