Skip to content

Installing P

P is built to be cross platform and can be used on MacOS, Linux, and Windows. We provide a step-by-step guide for installing P along with its required dependencies.

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

[Step 1] Install .Net Core SDK

The P compiler and checker are implemented in C# and hence the tool chain requires dotnet. P currently uses the specific version of .Net SDK 3.1. To install .Net Core 3.1 SDK use:

Installing .Net SDK on MacOS using Homebrew (details)

brew tap isen-ng/dotnet-sdk-versions
brew install --cask dotnet-sdk3-1-400
Dont have Homebrew? 🙃 Install directly using the installer.

Installing .Net SDK on Ubuntu (details)

wget https://packages.microsoft.com/config/ubuntu/21.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
sudo dpkg -i packages-microsoft-prod.deb
rm packages-microsoft-prod.deb
sudo apt-get update; \
sudo apt-get install -y apt-transport-https && \
sudo apt-get update && \
sudo apt-get install -y dotnet-sdk-3.1

Installing .Net SDK on Amazon Linux (details)

sudo rpm -Uvh https://packages.microsoft.com/config/centos/7/packages-microsoft-prod.rpm
sudo yum install dotnet-sdk-3.1

Installing .Net SDK on Windows using the installer (details)

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

dotnet --list-sdks

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

[Step 2] Install Java Runtime

P compiler uses ANTLR parser and hence requires java. If you already have Java installed 😇, ignore this step. To install Java use:

Installing Java on MacOS using Homebrew (details)

brew install java
Dont have Homebrew? Directly use installer.

Installing Java on Ubuntu (details)

sudo apt install default-jre

Installing Java 8 on Amazon Linux (you can use any version of java > 8)

sudo yum install java-1.8.0-openjdk

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.

[Step 3] Install P Compiler

Install the P compiler as a dotnet tool using the following command:

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

After installation, run which pc and it should show:

which pc
/Users/<user>/.dotnet/tools/pc
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 pc 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

[Step 4] Install P Checker

The current P checker depends on Coyote (previously P#)

Install the Coyote version 1.0.5 using the following command:

dotnet tool install --global Microsoft.Coyote.CLI --version 1.0.5
Troubleshoot: Confirm that coyote is correctly installed on your machine

After installation, run which coyote and it should show:

which coyote
coyote is /Users/<user>/.dotnet/tools/coyote
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 an error that coyote command not found, its most likely that $HOME/.dotnet/tools is not in your PATH.

We highly recommend that you create the following alias as we use it in the rest of tutorials and getting started guide:

Add following alias to the bash profile (~/.bash_profile or the equivalent on your system) so that you can invoke the P checker (pmc) directly.

alias pmc='coyote test'

We recommend that you add the following to the Microsoft.PowerShell_profile normally found in D:\Users\<username>\Documents\WindowsPowerShell

function pmc { coyote test $args }

Using P

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