Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
install dafny
#Dependencies: Install Mono from the official repositories;
#the version in most distribution repositories is too out of date.
#The mono-devel package is what you need.
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
echo "deb http://download.mono-project.com/repo/ubuntu xenial main" | sudo tee /etc/apt/sources.list.d/mono-official.list
sudo apt-get -y update
#Create an empty base directory
mkdir ~/.dafny
cd ~/.dafny
#Download and build Boogie:
git clone https://github.com/boogie-org/boogie
cd boogie
wget https://nuget.org/nuget.exe
mono ./nuget.exe restore Source/Boogie.sln
msbuild Source/Boogie.sln
cd ..
#Download and build Dafny:
cd ~/.dafny
git clone https://github.com/Microsoft/dafny.git ~/.dafny/dafny
msbuild dafny/Source/Dafny.sln
#Download and unpack z3 (Dafny looks for z3 in Binaries/z3/bin/)
cd ~/.dafny
wget https://github.com/Z3Prover/z3/releases/download/z3-4.6.0/z3-4.6.0-x64-ubuntu-16.04.zip
unzip z3-4.6.0-x64-ubuntu-16.04.zip
mv z3-4.6.0-x64-ubuntu-16.04 dafny/Binaries/z3
#(Optional) If you plan to use Boogie directly, copy (or symlink) the z3 binary so that Boogie, too, can find it:
cd ~/.dafny
rm -f boogie/Binaries/z3.exe
cp dafny/Binaries/z3/bin/z3 boogie/Binaries/z3.exe
# Run Dafny using the dafny shell script in the Binaries directory (it calls mono as appropriate)
cd ~/.dafny/dafny/Bin*
./dafny
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment