Install on macOS
You can install Pact on macOS by using the Homebrew package manager or by downloading and installing the appropriate binary for the local system architecture.
Prerequisites
If you want to install Pact on macOS using the Homebrew package manager (recommended), you should verify that you have Homebrew installed by running the following command:
brew --version
This command should display output similar to the following:
Homebrew 4.3.23
If you don't have Homebrew installed, see Homebrew for installation instructions and additional information about using the package manager.
In addition to Homebrew, if you are installing Pact 4.x, you should note that this version of Pact requires the z3 theorem prover from Microsoft Research to support formal verification.
Starting with Pact 5, Pact no longer supports formal verification using the z3 theorem prover.
If you are installing Pact 5, or later, you can continue to the Installation instructions.
If you are installing Pact 4.x, you can install and verify the installation of the z3 package on Linux by running the following commands:
brew install z3
z3 --version
If z3 is installed properly, you should see output similar to the following:
Z3 version 4.13.3 - 64 bit
Installation instructions
To install Pact on macOS using Homebrew:
-
Open a terminal shell on your local computer.
-
Update the
brewpackage manager by running the following command:brew update -
Install the
pactbinary and related dependencies by running the following command:brew install kadena-io/pact/pact -
Verify the installation by checking the Pact version:
pact --version -
View usage information for the pact interactive interpreter by running the following command:
pact --helpFor more information about the command-line options, see Pact command-line interpreter. For an introduction to Pact programming and language features, see Pact features and conventions.
To install Pact on macOS from a compressed archive:
-
Navigate to the appropriate Pact Releases page:
- Pact 4 Releases to download the latest stable version of Pact 4.x.
- Pact 5 Releases to download the latest version of Pact 5.
-
Download the latest
pact-<version>-macos-<arch>.tar.gzfile for the macOS operating system and architecture you use. -
Double-click the downloaded file to extract the contents.
-
Use the Finder to navigate to the
pactbinary in the extracted directory, select the binary, right-click, then click Open. -
Click Open to override system setting settings:
Troubleshooting
If you encounter issues, check the following:
-
Check the Pact version and, if Pact, version 4.x, is installed, verify that you have
z3installed.pact --versionThis command should display output similar to the following:
pact version 4.13If the Pact version is 4.x, check for the z3 package by running the following command:
z3 --versionIf
z3is installed correctly, the command should display output similar to the following:Z3 version 4.13.0 - 64 bitIf necessary, install
z3by running the following command:brew install z3 -
Verify the
pactbinary can be located and is in a directory included in yourPATHenvironment variable.First check the path to the
pactbinary by running the following command:which pactThis command should display the current path to the
pactbinary. For example:/opt/homebrew/bin/pactIf the command doesn't display the path to the
pactbinary, you should try reinstallingpactusingbrew, from the prebuilt release archive, or from the source code. If thewhich pactcommand displays the path to thepactbinary, check thePATHenvironment variable to verify the path the the binary is include by running the following command:echo $PATHThis command should display output similar to the following:
//Users/pistolas/Library/pnpm:/opt/homebrew/bin:/opt/homebrew/bin:/Library/Frameworks/Python.framework/Versions/3.12/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/binThe
$PATHoutput should include the directory where thepactbinary is located. If the PATH environment variable doesn't include the directory, open your shell profile—for example, the~/.bashrcor~/.zshrcfile—in a text editor. Add the following line at the end of the file:export PATH="/path/to/pact-directory:$PATH"Save the shell profile file and exit.
Open a new terminal or reload the shell profile to complete the update.
-
Check Pact GitHub Issues for known issues or to report a problem with installing Pact.