Installing Moccasin¶
There are a few things you’ll need on your machine before you can install Moccasin. Please install the appropriate tools from the Prerequisites section. Once you have those, the recommended way to install Moccasin is via uv.
Prerequisites¶
Python 3.11 or later
Installation with uv¶
For those unfamiliar, uv is a fast python package manager, and that helps us install moccasin into it’s own isolated virtual environment, so we don’t get any weird dependency conflicts with other python packages. It’s similar to pip and pipx if you’ve used them before. It even comes with some pip compatibility, will tools like uv pip install.
It’s highly recommended you understand how virtual environments work as well.
The easiest way to install uv is:
curl -LsSf https://astral.sh/uv/install.sh | sh
But you can head over to the uv installation instructions for more options. If you don’t have at least Python 3.11 installed, you’ll need to install that first.
uv python install 3.11
Then, to install moccasin with uv, run:
uv tool install moccasin
Once installed, to verify that Moccasin is installed, you can run:
mox --version
And see an output like:
Moccasin CLI v0.1.0
Installation with pipx¶
Pipx is a tool to help you install and run end-user applications written in Python. It’s roughly similar to macOS’s brew
, JavaScript’s npx
, and Linux’s apt
.
pipx
installs Moccasin into a virtual environment and makes it available directly from the commandline. Once installed, you will never have to activate a virtual environment prior to using Moccasin.
pipx
does not ship with Python. If you have not used it before you will probably need to install it.
You can either head over to the pipx installation instructions or follow along below.
To install pipx
:
python -m pip install --user pipx
python -m pipx ensurepath
Note
You may need to restart your terminal after installing pipx.
To install moccasin then with pipx:
pipx install moccasin
Once installed, you can run the following command to verify that Moccasin is installed:
mox --version
And see an output like:
Moccasin CLI v0.1.0
Installation with pip¶
You can install with pip, and if you do so, it’s highly recommended you understand how virtual environments work.
To install with pip:
pip install moccasin
From source¶
To install from source, you’ll need the uv tool installed. Once installed, you can run:
git clone https://github.com/cyfrin/moccasin
cd moccasin
uv sync
source .venv/bin/activate
uv pip install -e .
And you will have mox in your virtual environment created from the uv tool. It’s highly recommended you understand how virtual environments work.