K Framework Release v6.0.102
K Framework Release v6.0.102
copyright: Copyright (c) K Team. All Rights Reserved.
Installing the K Framework
Fast Installation (preferred)
If you're on a system that supports Nix,
use this command to install via Nix:
bash <(curl https://kframework.org/install)
kup install k
You can update K with:
kup update k
And list available versions with:
kup list
This will take care of all the dependencies and specific versions used by K.
Note that the first run will take longer to fetch all the libraries and compile
sources. (30m to 1h)
If you are on Apple Silicon, kup
is currently the only way to install K
because of upstream issues in the general Haskell ecosystem.
Install through packages
We currently strive to provide packages for the following platforms:
- Ubuntu Focal Fossa (20.04) and Jammy Jellyfish (22.04)
- Debian Bookworm
- Arch Linux
- macOS Catalina (10.15), Big Sur (11) and Monterey (12) via Homebrew
- Docker Images
Pre-installation Notes
-
We do not currently support running K natively on Windows. To use K on
Windows 10, you are encouraged to install the
Windows Subsystem for Linux (version 2)
and follow the instructions for installing Ubuntu Focal.If you have already installed WSL, before proceeding, you will need to
enter the WSL environment. You can do this by:- opening up the command prompt (accessible by searching
cmd
or
command prompt
from the start menu); - using the
wsl.exe
command to access the WSL environment.
- opening up the command prompt (accessible by searching
-
To use K in other non-linux environments (e.g. Windows 8 or earlier),
you will need to use a virtual machine (VM) software. We assume you have:- Created a virtual machine
- Installed a Linux distribution (e.g. Ubuntu Focal Fossa) on your
virtual machine
Consult your virtual machine software if you need help with the above
steps. We recommend the free VirtualBox virtual machine software.Before proceeding, follow the virtual machine softare UI to start your
Linux virtual machine and enter the command line environment. -
WSL and virtual machine users should be aware that, if you use your web
browser to download the package, you will need to make it accessible to
the command line environment. For this reason, we recommend downloading the
package from the command line directly using a tool likewget
. For
example, you could copy the package download URL and then type:wget <package-download-url>
where
<package-download-url>
is replaced by the URL you just copied. -
K depends on version 4.8.15 of Z3, which may not be supplied by package
managers. If this is the case, it should be built and installed from source
following the
instructions in
the Z3 repository. Other versions (older and newer) are not supported by K,
and may lead to incorrect behaviour or performance issues.
Downloading Packages
Download the appropriate package from the GitHub, via the
Releases page.
Releases are generated as often as possible from master
build.
Installing Packages
For version X.Y.Z
, distribution DISTRO
, and package ID ID
, the following
instructions tell you how to install on each system. Note that this typically
requires about ~1.4GB of dependencies and will take some time.
- On Linux systems, K will typically be installed under
/usr
. - On macOS/brew, K will typically be installed under
/usr/local
.
Ubuntu Focal (20.04)
sudo apt install ./kframework_amd64_ubuntu_focal.deb
Ubuntu Jammy (22.04)
sudo apt install ./kframework_amd64_ubuntu_jammy.deb
Debian Bookworm
sudo apt install ./kframework_amd64_debian_bookworm.deb
Arch Linux
pacman -U ./kframework_arch_x86_64.pkg.tar.zst
MacOS X Mojave/Homebrew
Homebrew (or just brew) is a third-party package manager
for MacOS.
If you have not installed brew, you must do so before installing the K
Framework brew package.
With brew installed, do the following to install the K Framework brew package
(with build number BN
):
brew install kframework--X.Y.Z.ID.bottle.BN.tar.gz -v
Note: we do not yet have a MacOS Monterey bottle. The existing brew package
also does not work on M1 Silicon Macs. If you have either of these systems,
you should build from source for the time being.
Homebrew Alternate Installation
To directly install the latest K Framework brew package without needing to
download it separately, do the following:
brew install kframework/k/kframework
Or, to streamline future K Framework upgrades, you can tap
the K Framework
package repository. This lets future installations/upgrades/etc... use the
unprefixed package name.
brew tap kframework/k
brew install kframework
Docker Images
Docker images with K pre-installed are available at the
runtimeverification/kframework-k Docker Hub repository.
Each release at COMMIT_ID
has an image associated with it at
runtimeverificationinc/kframework-k:ubuntu-focal-COMMIT_ID
.
To run the image directly:
docker run -it runtimeverificationinc/kframework-k:ubuntu-focal-COMMIT_ID
and to make a Docker Image based on it, use the following line in your
Dockerfile
:
FROM runtimeverificationinc/kframework-k:ubuntu-focal-COMMIT_ID
We also create Ubuntu 22.04 images with the ubuntu-jammy-COMMIT_ID
tags.
Testing Packages
The easiest way to test the K package is to copy a K tutorial language and
check if you can compile and run an included example.
-
Start by copying the K tutorial to some work directory
(e.g.$HOME/pl-tutorial
) from the K distribution root. Using a Linux
package, this command typically will be like:$ cp -R /usr/share/kframework/pl-tutorial $HOME/pl-tutorial
On macOS/brew, this command typically will be like:
$ cp -R /usr/local/share/kframework/pl-tutorial $HOME/pl-tutorial
This step is needed because sometimes only the
root
user can run the
examples in the default installation directory. -
Now you can try to run some programs:
$ cd $HOME/pl-tutorial/2_languages/1_simple/1_untyped $ make kompile $ krun tests/diverse/factorial.simple