Home/Q&A/Can a self-hosted runner keep DerivedData and dependency caches between builds?

Can a self-hosted runner keep DerivedData and dependency caches between builds?

Updated · airankrush

Direct answer

Yes. This is the most practical difference between an always-on machine and a cloud runner that starts fresh every time. Files stay on disk and the next build picks them up, with no cache upload or download.

Basis

  • GitHub's documentation describes the two kinds of runner this way: each GitHub-provided runner is a new virtual machine, while a self-hosted runner does not need to have a clean instance for every job (Self-hosted runners, checked 2026-11-12).
  • Worth keeping: incremental build results in ~/Library/Developer/Xcode/DerivedData, download caches for Swift packages and CocoaPods, tools installed with Homebrew, downloaded simulator runtimes, and the installed copy of Xcode itself.
  • DerivedData lives under the user folder by default, not in the runner's working folder, so the cleanup done on the working folder at checkout does not touch it. For the exact cleanup behavior of the checkout action, follow the actions/checkout documentation.
  • A cloud runner relies on a cache action to pack folders, upload them, and download and unpack them next time. The bigger the cache, the slower that step. An always-on machine has no such step.

Information as of .

Boundaries: when the answer is different

Keeping state has a cost. Caches go stale: after switching Xcode versions or changing build settings or dependency versions, old derived data can cause baffling failures or, worse, let a build pass that should have failed. So release builds should still be clean builds, with incremental builds used for everyday commits. A cache is not a backup either; the whole machine is erased after the rental ends. It also keeps eating disk space. How much faster things get depends on the project. We have no measured data and give no ratio.

How to do it

  1. Leave clean out of everyday builds so xcodebuild reuses derived data.
  2. Use -derivedDataPath to pin a folder per project or per runner so each can be cleared separately.
  3. Schedule a full build with derived data deleted once a week, preferably at night.
  4. After upgrading Xcode, clear derived data by hand once before resuming the pipeline.
  5. When an odd error appears only on the build machine, clear the cache and rerun as the first step.

Use case

This question belongs to the use case: Rented Mac mini as an always-on build machine for small teams? Count your build minutes first

Other questions in the same use case:

Pricing and availability: see the plans page · Help center (中文) · Refund policy (中文) · Telegram Contact support

Back to home · All Q&A