Pre-built packages
The easiest way to install Z3 is through language-specific package managers. These include both the Z3 library and language bindings.Python
Install via pip (recommended):JavaScript/TypeScript
Install via npm:.NET
Install the NuGet package:.csproj file:
Java
Add to your Mavenpom.xml:
For IDE setup instructions (Eclipse, IntelliJ IDEA, Visual Studio Code), see the Java IDE Setup Guide.
Pre-built binaries
Download pre-built binaries for stable and nightly releases from the GitHub Releases page. These releases include:- The
z3command-line executable - Static and shared libraries
- Header files
- Language bindings
- Linux
- macOS
- Windows
- Download the appropriate release for your architecture (x64, ARM, etc.)
- Extract the archive:
- Add to your PATH:
Building from source
Building from source gives you the latest features and allows customization. Z3 requires Python 3.x and C++20 support.Using CMake (recommended)
CMake is the recommended build system for most platforms.For detailed CMake options and configuration, see README-CMake.md in the Z3 repository.
Using Make
For Linux and macOS systems, you can use the traditional Make-based build:Build options
Build options
Specify compiler:Custom install prefix:64-bit build (Windows):Enable Python bindings:
Using Visual Studio
For Windows developers using Visual Studio:Open Visual Studio Command Prompt
Launch the “Developer Command Prompt” for your Visual Studio version.
Z3 uses C++20, so Visual Studio 2019 or later is recommended.
/guard:cf) and Address Space Layout Randomization (/DYNAMICBASE). To disable:
Using Bazel
Z3 can be built with Bazel on Ubuntu and other platforms:Using vcpkg
vcpkg is a cross-platform package manager:Building language bindings
When building from source, you can enable specific language bindings.Python bindings
- CMake
- Make
Java bindings
JAVA_HOME if CMake can’t find your Java installation:
.NET bindings
Go bindings
Go bindings require Go 1.20+ and shared library:OCaml bindings
Dependencies
Z3 has minimal dependencies:- Required: C++ runtime libraries, pthreads (for multi-threading)
- Optional: GMP (GNU Multiple Precision library) for faster arithmetic
- Build-time: Python 3.x
Platform-specific notes
Linux
Linux
Most Linux distributions can build Z3 with the default GCC or Clang compiler.Install build dependencies:
macOS
macOS
Install Xcode command-line tools:Or install via Homebrew:
Windows
Windows
- Use Visual Studio 2019 or later for C++20 support
- Alternatively, use Clang or MinGW with CMake
- For Cygwin builds, use Cygwin’s Python and the Mingw-w64 cross-compiler
AIX
AIX
See AIX build settings for platform-specific configuration.
Verifying installation
After installation, verify Z3 is working:- Command line
- Python
- Java
Troubleshooting
Python import error
Python import error
If you get
ImportError: No module named z3:- Ensure Z3 is installed:
pip list | grep z3 - Check you’re using the right Python environment
- Verify PYTHONPATH includes the Z3 installation directory
Library not found (Linux/macOS)
Library not found (Linux/macOS)
If you see Add these to your
error while loading shared libraries: libz3.so:.bashrc or .zshrc for persistence.CMake can't find compiler
CMake can't find compiler
Set the compiler explicitly:
Build fails with C++ errors
Build fails with C++ errors
Z3 requires C++20. Ensure your compiler is recent enough:
- GCC 10 or later
- Clang 10 or later
- Visual Studio 2019 or later
Next steps
Quickstart tutorial
Solve your first problem with Z3
Python bindings
Learn the Python API in depth
Building Z3
Advanced build configuration and options
Examples
Explore code examples and tutorials
