TL;DR — Quick Summary
sccache caches compilation results across builds. Speed up Rust, C, and C++ builds by caching compiler outputs locally, on S3, GCS, or Azure. Like ccache but for Rust too.
sccache makes builds faster. Cache compilations locally or in the cloud — rebuild in seconds.
Installation
# Cargo
cargo install sccache
# macOS
brew install sccache
Setup
# Set as Rust compiler wrapper
export RUSTC_WRAPPER=sccache
# Add to ~/.bashrc or ~/.zshrc for persistence
echo 'export RUSTC_WRAPPER=sccache' >> ~/.bashrc
# For C/C++ (set CC/CXX)
export CC="sccache gcc"
export CXX="sccache g++"
Usage
# Build with sccache (automatic with RUSTC_WRAPPER)
cargo build
# Show cache statistics
sccache --show-stats
# Start sccache server
sccache --start-server
# Clear cache
sccache --zero-stats
Summary
- sccache caches Rust, C, and C++ compilation results
- Drop-in replacement: set RUSTC_WRAPPER=sccache
- Cloud backends: S3, GCS, Azure, Redis, Memcached
- Shows cache hit rates with —show-stats
- Written in Rust by Mozilla — production-proven