Skip to main content
For developers

Clear Xcode DerivedData in one click

A DockRun workflow that deletes Xcode's DerivedData to win back disk space and clear strange build errors. Your projects are not touched.

The button needs DockRun 0.1.19 or later. On an older version, download the file, then use Settings > Restore or Import… in DockRun.

Runs in DockRun Free, which holds 2 workflows.

What it does

  • Checks that Xcode is closed, and stops with a clear message if it is open.
  • Measures the DerivedData folder, then empties it.
  • Tells you how much space came back.

The steps

Read the script below before you add it. It is everything this workflow runs.

  1. 1. Delete DerivedData
    Runs this zsh script · Time limit: 120 seconds
    # Deletes Xcode's build data (DerivedData). Xcode rebuilds it the next time you build; your projects are not touched.
    dir="${*:-~/Library/Developer/Xcode/DerivedData}"; dir="${dir/#\~/$HOME}"
    [[ "$dir" == */DerivedData ]] || { echo "Refusing: $dir is not a DerivedData folder." >&2; exit 1 }
    [ -d "$dir" ] || { echo "No DerivedData folder, nothing to clean."; exit 0 }
    if pgrep -x Xcode >/dev/null; then echo "Xcode is open. Quit Xcode, then run this again." >&2; exit 1; fi
    size=$(du -sh "$dir" 2>/dev/null | cut -f1)
    rm -rf "$dir"/*(DN)
    echo "Removed ${size:-0B} of Xcode build data."
    

After you add it

  1. DockRun shows what is in the file and asks before adding it. The workflow arrives turned off.
  2. Open it, read the steps, then turn on the On switch.
  3. Press Run. DockRun asks before a script runs; tick "Don't ask again for this exact step" once you trust it.

Good to know

The next build of each project takes longer, because Xcode has to rebuild what was deleted.

Last tested: 2026-11-12 · All workflows →

Curious if DockRun is right for you?

Let ChatGPT, Claude, or Perplexity look into it - click below and see what AI actually thinks about DockRun.

Clear Xcode DerivedData in one click | DockRun