Skip to content

Installation

This guide will help you install SpecMon and get it running on your system.

Before installing SpecMon, ensure you have the following prerequisites installed:

  • Go 1.21.4+ - SpecMon is written in Go and requires a recent version

    • Download from go.dev
    • Verify installation: go version
  • Git - For cloning the repository and managing dependencies

    • Download from git-scm.com
    • Verify installation: git --version
  • Tamarin - For formal verification (optional)
  1. Clone the repository:

    Terminal window
    git clone https://github.com/specmon/specmon.git
    cd specmon
  2. Build the application:

    Terminal window
    make build

    Or alternatively:

    Terminal window
    go build .
  3. Verify the installation:

    Terminal window
    ./specmon --version

If you’re using Nix, you can set up the complete development environment:

  1. Clone the repository:

    Terminal window
    git clone https://github.com/specmon/specmon.git
    cd specmon
  2. Enter the Nix development shell:

    Terminal window
    nix develop

    This provides all necessary dependencies including Go, development tools, and linters.

  3. Build the application:

    Terminal window
    go build

To verify that SpecMon is correctly installed:

  1. Check version:

    Terminal window
    ./specmon --version
  2. Display help:

    Terminal window
    ./specmon --help

    You should see output similar to:

    SpecMon is a runtime specification monitor using multiset-rewrite rules
    Usage:
    specmon [flags]
    specmon [command]
    Available Commands:
    completion Generate the autocompletion script for the specified shell
    help Help about any command
    monitor monitor the event trace
    Flags:
    -c, --cpu-profile-path string cpu profile path
    -d, --decompose decompose rules (default true)
    -h, --help help for specmon
    -l, --log-level string log level (default "error")
    -m, --mem-profile-path string memory profile path
    -q, --quiet quiet output
    -r, --role string role
    -s, --spec-path string specification path
    -v, --verbose verbose output
    --version version for specmon
  3. Test with a sample specification:

    See the Quick Start guide for a complete example.

To use SpecMon from anywhere in your system, add the directory containing the binary to your PATH:

Linux/macOS (Bash):

Terminal window
# Add to your shell configuration
echo 'export PATH="$PATH:$HOME/path/to/specmon"' >> ~/.bashrc
source ~/.bashrc

macOS (ZSH):

Terminal window
echo 'export PATH="$PATH:$HOME/path/to/specmon"' >> ~/.zshrc
source ~/.zshrc

Enable shell completion for better command-line experience:

Bash:

Terminal window
./specmon completion bash > /tmp/specmon_completion.bash
sudo mv /tmp/specmon_completion.bash /etc/bash_completion.d/

ZSH:

Terminal window
./specmon completion zsh > "${fpath[1]}/_specmon"

Fish:

Terminal window
./specmon completion fish > ~/.config/fish/completions/specmon.fish

Go version too old:

Error: go: version "go1.20" does not match go tool version "go1.21.4"

Solution: Upgrade to Go 1.21.4 or later

Permission denied:

Error: permission denied: ./specmon

Solution: Make the binary executable: chmod +x specmon

Missing dependencies:

Error: cannot find module

Solution: Run go mod tidy to download dependencies

Build fails: Solution: Ensure you have a clean Go environment:

Terminal window
go mod tidy
go clean -cache
make build

If you encounter issues during installation:

  1. Check the GitHub Issues for known problems
  2. Ensure all prerequisites are properly installed
  3. Try building with verbose output: go build -v .
  4. For development setup issues, verify your Go environment: go env

Once SpecMon is installed, continue with:

Interested in contributing to SpecMon? See the Contributing Guidelines on GitHub.