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 | iexmacOS / Linux
Open a terminal and run:
curl --proto '=https' --tlsv1.2 -sSf https://www.mana-lang.org/install.sh | shAfter installation, restart your terminal and verify:
mana --versionWhat Gets Installed
The installer sets up the complete Mana toolchain:
| Component | Location | Description |
|---|---|---|
mana | ~/.mana/bin/mana | Main compiler |
mana-lsp | ~/.mana/bin/mana-lsp | Language Server for IDE support |
mana-debug | ~/.mana/bin/mana-debug | Debug adapter for debugging |
mana_runtime.h | ~/.mana/include/ | C++ runtime header |
| Examples | ~/.mana/examples/ | Sample Mana programs |
The installer also:
- Adds
~/.mana/binto your PATH - Sets the
MANA_HOMEenvironment 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)
- Download Visual Studio 2022
- Install the "Desktop development with C++" workload
- The
clcompiler will be available in the Developer Command Prompt
Option 2: MinGW-w64
- Download MinGW-w64
- Add the
bindirectory to your PATH - Use
g++to compile
Option 3: LLVM/Clang
- Download LLVM
- Add to PATH during installation
- Use
clang++to compile
macOS
Install Xcode Command Line Tools:
xcode-select --installThis provides both clang++ and g++ (which is aliased to clang on macOS).
Linux
Debian/Ubuntu:
sudo apt update
sudo apt install g++ build-essentialFedora/RHEL:
sudo dnf install gcc-c++Arch Linux:
sudo pacman -S gccInstallation 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 -UninstallUnix 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 --helpManual 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:
| Platform | Architecture | File |
|---|---|---|
| Windows | x64 | mana-X.X.X-windows-x64.zip |
| Windows | ARM64 | mana-X.X.X-windows-arm64.zip |
| macOS | x64 (Intel) | mana-X.X.X-macos-x64.tar.gz |
| macOS | ARM64 (Apple Silicon) | mana-X.X.X-macos-arm64.tar.gz |
| Linux | x64 | mana-X.X.X-linux-x64.tar.gz |
| Linux | ARM64 | mana-X.X.X-linux-arm64.tar.gz |
2. Extract the Archive
Windows:
Expand-Archive mana-X.X.X-windows-x64.zip -DestinationPath C:\manaUnix:
tar -xzf mana-X.X.X-linux-x64.tar.gz
mv mana-X.X.X ~/.mana3. 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" $PATH4. Verify Installation
mana --versionBuilding 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.ps1Unix:
./installer/mana-init.shThe 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 cleanUnix:
./scripts/build.sh release
./scripts/build.sh test
./scripts/build.sh cleanDirectory 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
| Variable | Description | Default |
|---|---|---|
MANA_HOME | Root installation directory | ~/.mana |
PATH | Should include $MANA_HOME/bin | Set 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 -UninstallUnix:
# Option 1: Run the uninstaller in MANA_HOME
~/.mana/uninstall.sh
# Option 2: Use the installer with --uninstall
./mana-init.sh --uninstallManual Uninstallation
-
Remove the installation directory:
rm -rf ~/.mana -
Remove from PATH and MANA_HOME from your shell configuration file
-
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:
- Open VS Code
- Go to Extensions (Ctrl+Shift+X)
- Search for "Mana"
- Install the extension
Or from the command line:
code --install-extension mana-lang.manaThe 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"
- Restart your terminal - PATH changes require a new terminal session
- Check if Mana is in your PATH:
echo $PATH | tr ':' '\n' | grep mana - 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_programOr on Windows:
cl /std:c++17 /I %USERPROFILE%\.mana\include your_program.cppWindows: "Running scripts is disabled"
Enable PowerShell script execution:
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUserBuild 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 | iexPermission Denied on Unix
Make the installer executable:
chmod +x mana-init.sh
./mana-init.shUpdating Mana
To update to a new version, simply run the installer again:
Windows:
irm https://www.mana-lang.org/install.ps1 | iexUnix:
curl --proto '=https' --tlsv1.2 -sSf https://www.mana-lang.org/install.sh | shThe installer will overwrite the existing installation with the new version.
Getting Help
- Documentation: https://www.mana-lang.org/docs
- Report Issues: https://github.com/klaus-i-am/mana-lang/issues
- Discussions: https://github.com/klaus-i-am/mana-lang/discussions
Next Steps
Now that Mana is installed, let's write your first program in Hello World.