Skip to content

Installing P

Installing P

Looking for P 1.x?

If you want to use older P version 1.x.x, please use the installation steps here.

P is built to be cross-platform and can be used on MacOS, Linux, and Windows. Follow the steps below to install P along with the required dependencies.

Verify each step

After each step, use the troubleshooting check to ensure the installation succeeded.

Prefer Docker? Skip the manual setup

If you just want to try P, or you are running in CI, you can use the official Docker image instead of installing the toolchain by hand. It bundles the .NET SDK, JDK, Maven, graphviz, and the p CLI. Jump to Alternative: Use the Docker image.


Install .NET SDK

The P compiler is implemented in C# and hence the tool chain requires dotnet. P currently uses the specific version of .Net SDK 8.0.

Installing .Net SDK on MacOS using Homebrew (details)

brew tap isen-ng/dotnet-sdk-versions
brew install --cask dotnet-sdk8-0-200

Dont have Homebrew? 🙃 Install manually using the installer for x64 or Arm64.

Installing .Net SDK on Ubuntu (details)

wget https://packages.microsoft.com/config/ubuntu/22.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
sudo dpkg -i packages-microsoft-prod.deb
rm packages-microsoft-prod.deb
sudo apt update && sudo apt install -y dotnet-sdk-8.0

Installing .Net SDK on Amazon Linux 2 (details)

wget https://dotnet.microsoft.com/download/dotnet/scripts/v1/dotnet-install.sh
chmod +x dotnet-install.sh
./dotnet-install.sh  -c 8.0 -i ~/.dotnet

# If using a bash shell, replace .zshrc with .bashrc in the below commands
echo 'PATH=$HOME/.dotnet:$HOME/.dotnet/tools:$PATH' >> ~/.zshrc
echo 'export PATH' >> ~/.zshrc
source ~/.zshrc

sudo mkdir /usr/share/dotnet/
sudo cp -r ~/.dotnet/* /usr/share/dotnet/

Installing .Net SDK on Windows using the installer for x64 or Arm64

Troubleshoot: Confirm that dotnet is correctly installed on your machine.
dotnet --list-sdks

You must see an SDK with 8.0.* dotnet version installed. If you get dotnet command not found error, mostly likely, you need to add the path to dotnet in your PATH.

Useful resources:


Install Java Runtime

The P compiler also requires Java (java version 11 or higher).

Installing Java on MacOS using Homebrew (details)

brew install java
Dont have Homebrew? Directly use installer.

Installing Java on Ubuntu (details)

sudo apt install -y default-jre

Installing Java 17 on Amazon Linux (you can use any version of java >= 11)

sudo yum install -y java-17-amazon-corretto

Installing Java on Windows (details)

Troubleshoot: Confirm that java is correctly installed on your machine.
java -version

If you get java command not found error, mostly likely, you need to add the path to java in your PATH.


Install P Tool

Finally, install the P tool as a dotnet tool:

dotnet tool install --global P
Troubleshoot: Confirm that p is correctly installed on your machine

After installation, run which p and it should show:

which p
/Users/<user>/.dotnet/tools/p
If not, add $HOME/.dotnet/tools to $PATH in your .bash_profile (or equivalent) and try again after restarting the shell. If you are getting the error that the p command is not found, it is most likely that $HOME/.dotnet/tools is not in your PATH.

Updating P Compiler

You can update the version of P compiler by running the following command:

dotnet tool update --global P

Purpose Recommended Tool
Developing P programs Peasy (VS Code extension)
AI-assisted P development PeasyAI (Cursor / Claude Code)

Great 😄! You are all set to compile and check your first P program 🎓!


Alternative: Use the Docker image

Instead of installing the .NET SDK, Java, and the p tool separately, you can use the official P Docker image. This is the fastest way to get a working P toolchain, and is especially convenient for CI pipelines and for trying P without changing your machine's setup.

The image is published to the GitHub Container Registry (GHCR) and is built for both linux/amd64 and linux/arm64.

Prerequisite

You need Docker (or a compatible runtime such as Finch/Podman) installed.

Pull the image

docker pull ghcr.io/p-org/p:latest

You can also pin a specific version, e.g. ghcr.io/p-org/p:2.2.6.

Compile and check a P project

Mount your P project into the container's /workspace directory and run the p commands as usual:

# From the root of your P project (where the .pproj file lives)
docker run --rm -it -v "$PWD":/workspace ghcr.io/p-org/p:latest bash

# Now, inside the container:
p compile
p check -tc <testcase> -i 1000

Anything the tool writes (e.g. PGenerated/, PCheckerOutput/) lands back in your project directory on the host, because it is a mounted volume.

You can also run a one-shot command without an interactive shell:

docker run --rm -v "$PWD":/workspace ghcr.io/p-org/p:latest p compile
Troubleshoot: verify the toolchain inside the image
docker run --rm ghcr.io/p-org/p:latest bash -c 'p --version && java -version'

You should see the P version and a Java 17 runtime.