| Crates.io | z3 |
| lib.rs | z3 |
| version | 0.18.2 |
| created_at | 2015-12-28 06:23:56.693379+00 |
| updated_at | 2025-09-10 14:19:48.872398+00 |
| description | High-level rust bindings for the Z3 SMT solver from Microsoft Research |
| homepage | https://github.com/prove-rs/z3.rs |
| repository | https://github.com/prove-rs/z3.rs.git |
| max_upload_size | |
| id | 3776 |
| size | 398,426 |
High-level rust bindings to the Z3 SMT solver
Licensed under the MIT license.
See https://github.com/Z3Prover/z3 for details on Z3.
The API is fully documented with examples: https://docs.rs/z3/
This crate works with Cargo and is on
crates.io.
Add it to your project with cargo add:
$ cargo add z3
Note: This library has a dependency on Z3.
There are 4 ways for this crate to currently find Z3, controlled by the feature
flags bundled, vcpkg and gh-release.
This might look like:
[dependencies]
z3 = {version="0", features = ["gh-release"]}
or:
[dependencies]
z3 = {version="0", features = ["vcpkg"]}
By default, cargo will look for a system-installed copy of Z3.
On Linux, this would be via the package manager. On macOS, this
might be via Homebrew (brew install z3).
If installed with Homebrew, cargo may be unable to find the Z3 headers. In this
case set the Z3_SYS_Z3_HEADER environment variable to your copy of the z3.h
file. On Apple Silicon, this will typically be /opt/homebrew/include/z3.h:
Z3_SYS_Z3_HEADER=/opt/homebrew/include/z3.h cargo build
You may further have to set Z3_LIBRARY_PATH_OVERRIDE to /opt/homebrew/lib for the linker
to find the Z3 library. You can store these settings in the cargo configuration
file .cargo/config.toml of your project as follows:
[env]
Z3_LIBRARY_PATH_OVERRIDE = "/opt/homebrew/lib"
Z3_SYS_Z3_HEADER = "/opt/homebrew/include/z3.h"
Enabling the bundled feature will use cmake to build and statically
link Z3. This feature, as is, is only usable when z3 or z3-sys is used
as a git dependency, as it assumes the existence of a git submodule for
Z3. Users wishing to use this feature with the release of z3 or z3-sys on
crates.io must set Z3_SYS_BUNDLED_DIR_OVERRIDE to point to
their own checkout of Z3.
Enabling the vcpkg feature will use vcpkg to build and
install a copy of Z3 which is then used.
Enabling the gh-release feature will download a pre-compiled
copy of Z3 from the GitHub release page for the current platform,
if available. You may specify the version of Z3 to download via the
Z3_SYS_Z3_VERSION environment variable.
I am developing this library largely on my own so far. I am able to offer support and maintenance, but would very much appreciate donations via Patreon. I can also provide commercial support, so feel free to contact me.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, shall be dual licensed as above, without any additional terms or conditions.