Skip to main content

Installation

Zstandard can be installed using various package managers or built from source. Choose the method that best suits your development environment.

Quick install

# Clone the repository
git clone https://github.com/facebook/zstd.git
cd zstd

# Build and install
make
sudo make install
The make build system is the reference implementation and is recommended when your platform supports it. Other build systems are periodically updated to stay compatible.

Installation steps

1

Choose your installation method

Select the package manager or build system that matches your platform and workflow. For most Unix-like systems, the Makefile method is recommended.
2

Install dependencies

Ensure you have the necessary build tools:
  • Linux/macOS: gcc or clang, make
  • Windows: Visual Studio 2010 or later, or use CMake with your preferred compiler
  • All platforms: git for cloning the repository
3

Build and install

Follow the commands for your chosen method above. The build process will create:
  • zstd command-line tool (in root directory)
  • libzstd library (in lib/ directory)
  • Man pages and documentation
4

Verify installation

Test that Zstandard is correctly installed:
zstd --version
You should see output similar to:
*** Zstandard CLI (64-bit) v1.6.0, by Yann Collet ***

Build from source (detailed)

Using Makefile

The Makefile is the main build system and follows GNU Standard Makefile conventions:
# Basic build
make

# Install (requires sudo on most systems)
sudo make install

# Run tests
make check

# Clean build artifacts
make clean
The Makefile supports standard compilation flags, directory variables, and command variables following GNU conventions.

Using CMake

The CMake project generator can create Makefiles or other build scripts:
# Configure (builds in Release mode by default)
cmake -S . -B build-cmake

# Build
cmake --build build-cmake

# Install
sudo cmake --install build-cmake
For advanced CMake configuration options, see the project’s CMake documentation.

Using Meson

A Meson project is provided within build/meson:
cd build/meson
meson setup builddir
cd builddir
ninja
sudo ninja install

Platform-specific notes

macOS Universal2 build

You can build Zstandard with support for both Apple Silicon (M1/M2) and Intel processors:
cmake -S . -B build-cmake-universal \
  -G Ninja \
  -DCMAKE_OSX_ARCHITECTURES="x86_64;x86_64h;arm64"
  
cd build-cmake-universal
ninja
sudo ninja install

Windows with Visual Studio

Go into the build directory to find:
  • Projects for Visual Studio 2008 and 2010 (VS2010 project is compatible with VS2012-VS2017)
  • Automated build scripts in build/VS_scripts that build without opening Visual Studio
  • Recommended: Generate Visual Studio solutions using CMake
cmake -S . -B build-vs -G "Visual Studio 16 2019"
cmake --build build-vs --config Release

Using Buck

You can build the zstd binary via Buck:
buck build programs:zstd
The output binary will be in buck-out/gen/programs/.

Using Bazel

Integrate zstd into your Bazel project using the module hosted on the Bazel Central Repository.

Advanced build options

For specialized flags controlling binary generation and installation paths:
When building from source, prefer using the make build system when possible. Other build systems may have small feature differences due to synchronization challenges.

Package manager maintenance

The Zstandard packages in VCPKG and Conan are maintained by Microsoft team members and community contributors. If you find an outdated version:

Next steps

Quick start guide

Now that you have Zstandard installed, learn how to compress and decompress data with working code examples

Build docs developers (and LLMs) love