Skip to main content

Install Mojo

You can install Mojo as a Python or Conda package. This page shows you how to install using pixi, uv, pip, and conda, but you can use other tools.

Install

To get the latest version, we recommend installing our nightly build. If you want a better tested but older version, install the stable build. Both options are shown below.

  1. If you don't have it, install pixi:

    curl -fsSL https://pixi.sh/install.sh | sh
  2. Navigate to the directory where you want to create a project and run this:

    pixi init hello-world \
      -c https://conda.modular.com/max-nightly/ -c conda-forge \
      && cd hello-world

    This creates a project directory named hello-world, adds the channel for Modular conda packages, and enters the directory.

  3. Install Mojo:

    pixi add mojo
  4. Enter the virtual environment so you can access the mojo CLI:

    pixi shell

Verify your installation by printing the Mojo version:

mojo --version

Add the VS Code extension

If you're using Visual Studio Code or another IDE derived from it (such as Cursor), we recommend installing the Mojo extension, which provides features like syntax highlighting, code completion, and debugging support.

There are currently two extensions:

Follow the corresponding link above and click Install. Or, open the Extensions view in VS Code and search for "Mojo"—make sure you install the extension from Modular.

If you followed the installation steps above, your terminal should be in an environment with mojo installed. To run some code, you just need a .mojo file with a main() function:

  1. Create a file named hello.mojo with this code:

    hello.mojo
    def main():
        print("Hello, World!")
  2. Run it with the mojo CLI:

    mojo hello.mojo
    Hello, World!

Try some examples

We have a bunch of code examples on GitHub. Here's how to use them:

  1. Clone the repo:

    git clone https://github.com/modular/modular.git

    If you installed the stable version, make sure you check out the stable GitHub branch (the main branch is the nightly code). For example:

    git clone -b stable https://github.com/modular/modular.git
  2. Navigate to the examples:

    cd modular/examples/mojo
  3. Pick an example and run it with mojo.

    If you're using a package manager other than pixi, make sure mojo is installed and accessible in your current shell environment. Then run some code:

    mojo nbody.mojo

    If you installed pixi, there's nothing you need to do—our examples provide a pixi.toml file, which specifies package dependencies and environment settings. So you can immediately run the code and be sure you have the same version of Mojo that the code is written for. Instead of shelling into the environment, you can use pixi run:

    pixi run mojo nbody.mojo

Update

The following commands should update your local mojo package if a new version is available that's compatible with the version you specified when you installed it or added it as a package dependency. For more information about updating packages, see the docs for your package manager.

pixi update mojo

Uninstall

Mojo is installed as a Python or Conda package, so the normal package removal process applies.

This removes the package from your local project:

pixi remove mojo

This deactivates your virtual environment:

exit

What's included

We actually offer two Mojo packages: mojo and mojo-compiler.

For most situation, you want mojo because it includes all the developer tools (it's a superset of the mojo-compiler package).

mojo

This gives you everything you need for Mojo development.

Includes:

mojo-compiler

This package is smaller and is useful for environments where you only need to call or build existing Mojo code. For example, this is good if you're running Mojo in a production environment or when you're programming in Python and calling a Mojo package—situations where you don't need the LSP and debugger tools.

Includes:

System requirements

To install mojo or mojo-compiler, your system must meet these specifications.

  • macOS Ventura (13) or later
  • Apple silicon (M1/M2/M3/M4 processor)
  • Python 3.9 - 3.13
  • Xcode or Xcode Command Line Tools
  • We currently don't support Mac GPUs

GPU compatibility

Mojo supports both CPUs and GPUs, so you don't need a GPU to program with Mojo. But if you do want to program for GPUs with Mojo, we recommend the following GPUs.

Because we don't test every variant of a GPU architecture, and support for new architectures will improve incrementally, we've divided our list of compatible GPUs into 3 tiers:

Tier 1: Fully supported

We provide full support and testing for the following data center GPUs:

  • NVIDIA H100 and H200 (Hopper)
  • NVIDIA A100 and A10 (Ampere)
  • AMD Instinct MI300X and MI325X (CDNA3)

Tier 2: Confirmed compatibility

We've confirmed full compatibility with the following GPUs but we currently don't maintain tests for them:

  • NVIDIA L4 and L40 (Ada Lovelace)
  • NVIDIA RTX 40XX series (Ada Lovelace)
  • NVIDIA RTX 30XX series (Ampere)

Tier 3: Limited compatibility

We've either confirmed or received reports that the following GPUs work for GPU programming with Mojo and can execute basic graphs with MAX APIs. However, these GPUs currently can't run some GenAI models for various reasons:

  • NVIDIA Tesla P100 (Pascal)
  • NVIDIA RTX 20XX series (Turing)
  • NVIDIA T4 (Turing)
  • NVIDIA Jetson Orin and Orin Nano (Ampere)
  • NVIDIA GeForce RTX 3090 (Ampere)
  • NVIDIA GeForce GTX 1080 Ti (Pascal)
  • AMD Radeon 700M series (RDNA3)
  • AMD Radeon RX 7000 series (RDNA3)
  • AMD Radeon RX 9000 series (RDNA4)

If you've had success with any GPUs not listed here, please let us know on Discord.

GPU software requirements

Make sure you have the corresponding GPU software:

Was this page helpful?