Chapter I — Installation

In this chapter, we'll explore install the mana programming language on your system.

This guide covers all methods for installing the Mana programming language on your system.

Quick Install

Windows

Open PowerShell and run:

irm https://www.mana-lang.org/install.ps1 | iex

macOS / Linux

Open a terminal and run:

curl --proto '=https' --tlsv1.2 -sSf https://www.mana-lang.org/install.sh | sh

After installation, restart your terminal and verify:

mana --version

What Gets Installed

The installer sets up the complete Mana toolchain:

ComponentLocationDescription
mana~/.mana/bin/manaMain compiler
mana-lsp~/.mana/bin/mana-lspLanguage Server for IDE support
mana-debug~/.mana/bin/mana-debugDebug adapter for debugging
mana_runtime.h~/.mana/include/C++ runtime header
Examples~/.mana/examples/Sample Mana programs

The installer also:

  • Adds ~/.mana/bin to your PATH
  • Sets the MANA_HOME environment variable

Prerequisites

Mana compiles to C++17, so you need a C++ compiler to build the generated code.

Windows

Option 1: Visual Studio 2022 (Recommended)

  1. Download Visual Studio 2022
  2. Install the "Desktop development with C++" workload
  3. The cl compiler will be available in the Developer Command Prompt

Option 2: MinGW-w64

  1. Download MinGW-w64
  2. Add the bin directory to your PATH
  3. Use g++ to compile

Option 3: LLVM/Clang

  1. Download LLVM
  2. Add to PATH during installation
  3. Use clang++ to compile

macOS

Install Xcode Command Line Tools:

xcode-select --install

This provides both clang++ and g++ (which is aliased to clang on macOS).

Linux

Debian/Ubuntu:

sudo apt update
sudo apt install g++ build-essential

Fedora/RHEL:

sudo dnf install gcc-c++

Arch Linux:

sudo pacman -S gcc

Installation Options

Windows PowerShell Options

# Install to a custom directory
.\mana-init.ps1 -InstallDir "C:\tools\mana"
 
# Install without modifying PATH (manual setup)
.\mana-init.ps1 -NoModifyPath
 
# Non-interactive installation (skip prompts)
.\mana-init.ps1 -Yes
 
# Uninstall Mana
.\mana-init.ps1 -Uninstall

Unix Shell Options

# Install to a custom directory
./mana-init.sh --prefix /opt/mana
 
# Uninstall Mana
./mana-init.sh --uninstall
 
# Show all options
./mana-init.sh --help

Manual Installation

If you prefer to install manually or the automated installer doesn't work for your system:

1. Download the Release

Download the appropriate archive from the releases page:

PlatformArchitectureFile
Windowsx64mana-X.X.X-windows-x64.zip
WindowsARM64mana-X.X.X-windows-arm64.zip
macOSx64 (Intel)mana-X.X.X-macos-x64.tar.gz
macOSARM64 (Apple Silicon)mana-X.X.X-macos-arm64.tar.gz
Linuxx64mana-X.X.X-linux-x64.tar.gz
LinuxARM64mana-X.X.X-linux-arm64.tar.gz

2. Extract the Archive

Windows:

Expand-Archive mana-X.X.X-windows-x64.zip -DestinationPath C:\mana

Unix:

tar -xzf mana-X.X.X-linux-x64.tar.gz
mv mana-X.X.X ~/.mana

3. Add to PATH

Windows (PowerShell):

# Add to user PATH permanently
$path = [Environment]::GetEnvironmentVariable("PATH", "User")
[Environment]::SetEnvironmentVariable("PATH", "$path;C:\mana\bin", "User")
 
# Set MANA_HOME
[Environment]::SetEnvironmentVariable("MANA_HOME", "C:\mana", "User")

Unix (bash/zsh):

# Add to ~/.bashrc or ~/.zshrc
export MANA_HOME="$HOME/.mana"
export PATH="$MANA_HOME/bin:$PATH"

Unix (fish):

# Add to ~/.config/fish/config.fish
set -gx MANA_HOME "$HOME/.mana"
set -gx PATH "$MANA_HOME/bin" $PATH

4. Verify Installation

mana --version

Building from Source

If you want the latest development version or need to build for an unsupported platform:

Requirements

  • CMake 3.14 or later
  • C++17 compatible compiler
  • Git (to clone the repository)

Build Steps

# Clone the repository
git clone https://github.com/klaus-i-am/mana-lang.git
cd mana-lang
 
# Create build directory
mkdir build && cd build
 
# Configure and build
cmake .. -DCMAKE_BUILD_TYPE=Release
cmake --build . --config Release
 
# The binaries are now in build/Release/ (Windows) or build/ (Unix)

Install from Local Build

After building, you can use the installer to install your local build:

Windows:

.\installer\mana-init.ps1

Unix:

./installer/mana-init.sh

The installer will detect and use the local build automatically.

Build Scripts

For convenience, build scripts are provided:

Windows:

scripts\build.bat release
scripts\build.bat test
scripts\build.bat clean

Unix:

./scripts/build.sh release
./scripts/build.sh test
./scripts/build.sh clean

Directory Structure

After installation, your Mana installation looks like this:

~/.mana/                    # MANA_HOME
├── bin/
│   ├── mana               # Main compiler executable
│   ├── mana-lsp           # Language Server Protocol server
│   └── mana-debug         # Debug adapter
├── include/
│   └── mana_runtime.h     # C++ runtime header (include when compiling)
├── examples/
│   ├── hello.mana
│   ├── structs.mana
│   └── ...
└── uninstall.sh           # Uninstaller script (or .ps1 on Windows)

Environment Variables

VariableDescriptionDefault
MANA_HOMERoot installation directory~/.mana
PATHShould include $MANA_HOME/binSet by installer

Uninstalling

Using the Uninstaller

Windows:

# Option 1: Run the uninstaller in MANA_HOME
~\.mana\uninstall.ps1
 
# Option 2: Use the installer with -Uninstall
.\mana-init.ps1 -Uninstall

Unix:

# Option 1: Run the uninstaller in MANA_HOME
~/.mana/uninstall.sh
 
# Option 2: Use the installer with --uninstall
./mana-init.sh --uninstall

Manual Uninstallation

  1. Remove the installation directory:

    rm -rf ~/.mana
  2. Remove from PATH and MANA_HOME from your shell configuration file

  3. On Windows, you may also need to remove environment variables:

    [Environment]::SetEnvironmentVariable("MANA_HOME", $null, "User")

IDE Integration

VS Code

Install the Mana extension for syntax highlighting, diagnostics, and IntelliSense:

  1. Open VS Code
  2. Go to Extensions (Ctrl+Shift+X)
  3. Search for "Mana"
  4. Install the extension

Or from the command line:

code --install-extension mana-lang.mana

The extension automatically uses mana-lsp for language features.

Other Editors

Any editor supporting LSP can use mana-lsp. Configure your editor to use:

mana-lsp

as the language server command for .mana files.

Troubleshooting

"mana: command not found"

  1. Restart your terminal - PATH changes require a new terminal session
  2. Check if Mana is in your PATH:
    echo $PATH | tr ':' '\n' | grep mana
  3. Source your shell config manually:
    source ~/.bashrc  # or ~/.zshrc

"Cannot find mana_runtime.h"

When compiling generated C++ code, include the Mana include directory:

g++ -std=c++17 -I ~/.mana/include your_program.cpp -o your_program

Or on Windows:

cl /std:c++17 /I %USERPROFILE%\.mana\include your_program.cpp

Windows: "Running scripts is disabled"

Enable PowerShell script execution:

Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser

Build Errors: Missing C++ Compiler

Make sure you have a C++ compiler installed (see Prerequisites).

Windows: "curl is not recognized"

Use PowerShell's Invoke-RestMethod instead:

irm https://www.mana-lang.org/install.ps1 | iex

Permission Denied on Unix

Make the installer executable:

chmod +x mana-init.sh
./mana-init.sh

Updating Mana

To update to a new version, simply run the installer again:

Windows:

irm https://www.mana-lang.org/install.ps1 | iex

Unix:

curl --proto '=https' --tlsv1.2 -sSf https://www.mana-lang.org/install.sh | sh

The installer will overwrite the existing installation with the new version.

Getting Help

Next Steps

Now that Mana is installed, let's write your first program in Hello World.