Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Installation

To use Mortar, you need to install the compilation tools. Don’t worry, the process is simple!

If you already have Rust installed, it’s very convenient:

cargo install mortar_cli

Wait for the installation to complete, then check if it was successful:

mortar --version

Seeing the version number means the installation was successful!

Method 2: Build from Source (Not for Average Users)

Want to experience the latest development version? You can build from source (this also requires a Rust development environment):

# Download source code
git clone https://github.com/Bli-AIk/mortar.git
cd mortar

# Build
cargo build --release

# The compiled program is here
./target/release/mortar --version

Tip: The compiled executable is located at target/release/mortar, you can add it to your environment variables.

Method 3: Download from GitHub Release (Not for Average Users)

If you don’t want to use Rust or Cargo, you can also download pre-compiled binaries directly from Mortar’s GitHub Release page.

Linux / macOS

  1. Open the Release page and download the corresponding version, for example mortar-x.x.x-linux-x64.tar.gz or mortar-x.x.x-macos-x64.tar.gz.
  2. Extract to any directory:
tar -xzf mortar-x.x.x-linux-x64.tar.gz -C ~/mortar
  1. Add the executable path to environment variables, for example:
export PATH="$HOME/mortar:$PATH"
  1. Check if installation was successful:
mortar --version

Windows

  1. Download the corresponding version of mortar-x.x.x-windows-x64.zip.
  2. Extract to any directory, for example D:\mortar.
  3. Add the directory to system environment variable PATH:
    • Right-click “This PC” → “Properties” → “Advanced system settings” → “Environment Variables”
    • Find Path in “System variables” or “User variables” → Edit → Add D:\mortar
  4. Open a new command prompt and check installation:
mortar --version

⚠️ Note:

  • Need to manually set environment variables
  • May encounter issues when opening new terminals or modifying system configuration
  • Not very user-friendly for average users

Therefore, we recommend Method 1 (Cargo) for a smoother installation experience.

Verify Installation

Run this command to test:

mortar --help

You should see help information explaining various usage options.

For a better writing experience, you can install the language server:

cargo install mortar_lsp

Then configure it in your favorite editor.

Check Editor Support to learn how to configure your editor.

Encountering Problems?

“cargo command not found”

You need to install Rust first. Visit https://rust-lang.org/ and follow the installation guide.

“Build failed”

Make sure your Rust version is new enough:

rustup update

Other Issues

Next Steps

Installed? Then go try out Quick Start Guide!