Installation
This guide will help you install SpecMon and get it running on your system.
Prerequisites
Section titled “Prerequisites”Before installing SpecMon, ensure you have the following prerequisites installed:
Required software
Section titled “Required software”-
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
Optional dependencies
Section titled “Optional dependencies”- Tamarin - For formal verification (optional)
- Download from tamarin-prover.github.io
- Used for specification verification but not required for runtime monitoring
Installation methods
Section titled “Installation methods”Method 1: from source
Section titled “Method 1: from source”-
Clone the repository:
Terminal window git clone https://github.com/specmon/specmon.gitcd specmon -
Build the application:
Terminal window make buildOr alternatively:
Terminal window go build . -
Verify the installation:
Terminal window ./specmon --version
Method 2: development setup with Nix
Section titled “Method 2: development setup with Nix”If you’re using Nix, you can set up the complete development environment:
-
Clone the repository:
Terminal window git clone https://github.com/specmon/specmon.gitcd specmon -
Enter the Nix development shell:
Terminal window nix developThis provides all necessary dependencies including Go, development tools, and linters.
-
Build the application:
Terminal window go build
Installation verification
Section titled “Installation verification”To verify that SpecMon is correctly installed:
-
Check version:
Terminal window ./specmon --version -
Display help:
Terminal window ./specmon --helpYou should see output similar to:
SpecMon is a runtime specification monitor using multiset-rewrite rulesUsage:specmon [flags]specmon [command]Available Commands:completion Generate the autocompletion script for the specified shellhelp Help about any commandmonitor monitor the event traceFlags:-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 -
Test with a sample specification:
See the Quick Start guide for a complete example.
System integration
Section titled “System integration”Add to PATH (optional)
Section titled “Add to PATH (optional)”To use SpecMon from anywhere in your system, add the directory containing the binary to your PATH:
Linux/macOS (Bash):
# Add to your shell configurationecho 'export PATH="$PATH:$HOME/path/to/specmon"' >> ~/.bashrcsource ~/.bashrcmacOS (ZSH):
echo 'export PATH="$PATH:$HOME/path/to/specmon"' >> ~/.zshrcsource ~/.zshrcShell completion (optional)
Section titled “Shell completion (optional)”Enable shell completion for better command-line experience:
Bash:
./specmon completion bash > /tmp/specmon_completion.bashsudo mv /tmp/specmon_completion.bash /etc/bash_completion.d/ZSH:
./specmon completion zsh > "${fpath[1]}/_specmon"Fish:
./specmon completion fish > ~/.config/fish/completions/specmon.fishTroubleshooting
Section titled “Troubleshooting”Common issues
Section titled “Common issues”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: ./specmonSolution: Make the binary executable: chmod +x specmon
Missing dependencies:
Error: cannot find moduleSolution: Run go mod tidy to download dependencies
Build fails: Solution: Ensure you have a clean Go environment:
go mod tidygo clean -cachemake buildGetting help
Section titled “Getting help”If you encounter issues during installation:
- Check the GitHub Issues for known problems
- Ensure all prerequisites are properly installed
- Try building with verbose output:
go build -v . - For development setup issues, verify your Go environment:
go env
Next steps
Section titled “Next steps”Once SpecMon is installed, continue with:
- Quick Start — Create and run your first monitor
- Specification Basics — Learn the specification language
Contributing
Section titled “Contributing”Interested in contributing to SpecMon? See the Contributing Guidelines on GitHub.