Starting with MacOS 10.13 Apple’s Caching Server service, now called Content Caching, checks if the system is running in a VM. See this article for more details: https://support.apple.com/en-gb/HT207828
When attempting to start Content Caching on a Virtualized Mac OS you will get an error message:
% sudo AssetCacheManagerUtil activate
AssetCacheManagerUtil[655:5522] Failed to activate content caching: Error Domain=ACSMErrorDomain Code=5 "virtual machine" UserInfo={NSLocalizedDescription=virtual machine}
To get around this we have to suppress the VMM flag. See this archived project https://github.com/ofawx/VmAssetCacheEnable for more info. One way to accomplish this is to use OpenCore with Lilu and the RestrictEvents kernel extensions.
This is my first experience with OpenCore so I’m no expert.
- Install and launch https://github.com/corpnewt/MountEFI to the Desktop folder or somewhere similar.
- Enter “b” to mount the boot EFI partition. You should see an EFI mount point in the finder containing an EFI folder
- Follow https://forums.macrumors.com/threads/opencore-on-the-mac-pro.2207814/ to get a basic opencore setup. Start at “Install the basic components“. This was the easiest way I found to get to a working setup with OpenCore.
- Download the latest Lilu release from https://github.com/acidanthera/Lilu/releases and the latest RestrictEvents release from https://github.com/acidanthera/RestrictEvents/releases. Place the kext from each in the EFI/OC/Kexts folder in the EFI partition.
- Open the config file and under Kernel/Add replace </array> with this, which will include the 2 kexts we added:
<array>
<dict>
<key>Arch</key>
<string>Any</string>
<key>BundlePath</key>
<string>Lilu.kext</string>
<key>Comment</key>
<string></string>
<key>Enabled</key>
<true/>
<key>ExecutablePath</key>
<string>Contents/MacOS/Lilu</string>
<key>MaxKernel</key>
<string></string>
<key>MinKernel</key>
<string></string>
<key>PlistPath</key>
<string>Contents/Info.plist</string>
</dict>
<dict>
<key>Arch</key>
<string>Any</string>
<key>BundlePath</key>
<string>RestrictEvents.kext</string>
<key>Comment</key>
<string></string>
<key>Enabled</key>
<true/>
<key>ExecutablePath</key>
<string>Contents/MacOS/RestrictEvents</string>
<key>MaxKernel</key>
<string></string>
<key>MinKernel</key>
<string></string>
<key>PlistPath</key>
<string>Contents/Info.plist</string>
</dict>
</array>
- Add
revpatch=assetto the existing NVRAM/Add/7C436110-AB2A-4BBB-A880-FE41995C9F82/boot-args key. This enables the Content Cache patch in the RestrictEvents kernel extension. - Save the config and reboot the system.
You should now be able to turn on Content Cache from system preferences or the command line using the sudo AssetCacheManagerUtil activate command.
Cloning Content Cache VM and ServerGUID
We have one Content Cache server running but it would be nice to have more than one. One of the benefits of running in a VM is the ease of cloning machines. Make sure to refresh the ServerGUID on the cloned machine. Otherwise the service will not peer. This error will be in the logs: Ignoring server at 172.17.16.120 because it has my ServerGUID
Refreshing the ServerGUID:
- Stop the caching service via System Preferences or with the
AssetCacheManagerUtildeactivate command. - Generate a new GUID:
sudo defaults write /Library/Preferences/com.apple.AssetCache.plist ServerGUIDuuidgen - Reboot the server (otherwise the UUID gets changed back).
- Start the caching service via System Preferences or with the
AssetCacheManagerUtilactivate command.
Troubleshooting tips:
- Verify OpenCore is working by listing 3rd party extensions with
kextstat | grep -v com.appleLilu and RestrictEvents should be listed. - Show Log:
Log stream --predicate 'subsystem == "com.apple.AssetCache"' --info