Skip to main content

Setup

This page covers end-to-end Mux setup, including runtime installs, compiler/tooling, and editor integration.

Language install

Compiler and runtime (prebuilt binaries)

The installer downloads a prebuilt compiler and runtime library, so you do not need Rust or the LLVM development libraries.

You do need a C compiler. Mux compiles your program to an object file and then calls one to link it, so this is required to run anything, not just to build from source. Any recent clang or gcc works and the version does not need to match the LLVM the compiler was built against - the linker never parses LLVM IR, only the object file:

  • Debian/Ubuntu: sudo apt-get install clang
  • Arch Linux: sudo pacman -S clang
  • macOS: xcode-select --install (the Command Line Tools ship clang)
  • Windows: install LLVM, for example via Chocolatey

The installer runs mux doctor when it finishes and tells you if anything is missing. You can re-run that check at any time.

Linux and macOS:

curl -fsSL https://raw.githubusercontent.com/muxlang/mux-compiler/main/scripts/install.sh | sh

Windows (PowerShell):

iwr -useb https://raw.githubusercontent.com/muxlang/mux-compiler/main/scripts/install.ps1 | iex

Custom install directories:

MUX_INSTALL_DIR=/usr/local/bin MUX_LIB_DIR=/usr/local/lib sh install.sh

Compiler and tooling (source builds)

For compiler development or source builds, you need LLVM 22 and clang. The bootstrap script installs the toolchain automatically.

git clone https://github.com/muxlang/mux-compiler
cd mux-compiler
./scripts/bootstrap-dev.sh
./scripts/dev-cargo.sh build -p mux-runtime -p mux-lang

Build both packages. Compiled Mux programs link libmux_runtime.a, and cargo emits a dependency's rlib but never its staticlib, so building only the compiler leaves programs failing to link. scripts/run-checks.sh does this for you.

Verify installation

mux version
mux doctor
mux doctor --dev

Syntax highlighting

Mux ships TextMate and Tree-sitter grammars. Use the section that matches your editor.

TextMate family (VSCode, Sublime Text, JetBrains)

Generate grammar (required before packaging):

cd mux-syntax-highlighting
node scripts/generate-syntax.js

VSCode:

  1. Package the extension:
    ../scripts/release-syntax.sh
  2. Install the .vsix:
    code --install-extension language-mux-<version>.vsix
  3. Reload VSCode.

Sublime Text:

  1. Copy mux-syntax-highlighting/textmate-mux/source.mux.json into Packages/User/Mux/.
  2. Add to Packages/User/Package.sublime-settings:
    {
      "syntax": [
        {
          "name": "Mux",
          "scope": "source.mux",
          "file_extensions": [".mux"],
          "path": "User/Mux/source.mux.json"
        }
      ]
    }

JetBrains (IntelliJ, WebStorm, etc.):

  1. Install the TextMate Bundles plugin.
  2. Import mux-syntax-highlighting/textmate-mux/source.mux.json.
  3. Associate .mux files in Settings > Editor > File Types.

Tree-sitter family (Neovim, Helix)

Generate grammar (required before packaging):

cd mux-syntax-highlighting
node scripts/generate-syntax.js

Neovim:

  1. Install the parser and queries from mux-syntax-highlighting/tree-sitter-mux/.
  2. Add to ~/.config/nvim/init.lua:
    local parser_config = require "nvim-treesitter.parsers".get_parser_configs()
    parser_config.mux = {
      install_info = {
        url = "https://github.com/muxlang/tree-sitter-mux",
        files = {"src/parser.c"},
        branch = "main"
      },
      filetype = "mux",
    }
  3. Run :TSInstall mux and enable highlighting.

Helix:

  1. Build the parser:
    mkdir -p ~/.config/helix/runtime/grammars
    cd mux-syntax-highlighting/tree-sitter-mux
    tree-sitter generate grammar.js
    cp mux.so ~/.config/helix/runtime/grammars/
  2. Add to ~/.config/helix/languages.toml:
    [[language]]
    name = "mux"
    scope = "source.mux"
    file-types = ["mux"]
    roots = []
    grammar = true
    
    [language.highlight]
    paths = ["queries/highlights.scm"]

LSP

In development. There is no supported Mux LSP release yet.

Playground local development

To run the docs site and compiler API locally for playground testing:

  1. Start the API server from the repo root:
uv run python api/server.py
  1. In a second terminal, start the website:
cd mux-website
npm start

The site runs on http://localhost:3000 and uses the production compile proxy (https://mux-ai.corniedj.workers.dev) by default. The proxy keeps browser traffic behind Cloudflare and authenticates its requests to the Fly origin.

To use your local API server instead, set this before starting the docs site:

MUX_API_URL=http://localhost:8080 npm start

Set MUX_API_URL when running a local API directly. Production deployments should keep the default Worker URL; do not expose the Fly origin to browser code.

Profiling

Profiling is done with external tools so it stays decoupled from the compiler and runtime.

Linux:

  • perf + flamegraph

macOS:

  • Instruments

Windows:

  • Windows Performance Analyzer or Visual Studio Profiler