Skip to content

Install package manager for Mojo

Mojo can be installed and run on MacOS and Linux. Currently, the support of Windows is not available. If you are using Windows, please use Windows Subsystem for Linux (WSL) to run Mojo.

Before programming in Mojo, you need to first set up two things:

  1. Install pixi, a command line (CLI) tool and package manager.
  2. Install mojo extension in your IDE (I would say VS Code is the best choice for now).

Install Pixi

Pixi is a package manager and virtual environment manager for Mojo (as well as other languages). You can install Pixi on MacOS, Linus, or Windows Subsystem for Linux (WSL) by running the following command in your terminal:

bash
curl -fsSL https://pixi.sh/install.sh | sh

Notes: Some instruction will be printed in your terminal. Read them carefully and run the source command or restart your terminal as instructed.

Now, the pixi binary is installed in the directory ~/.pixi/bin.

Modular family

You may be confused by the names of Modular's products. Here is a brief introduction to the Modular family:

DescriptionOfficial link
magicPackage and virtual environment manager (being deprecated)https://docs.modular.com/magic/
pixiPackage and virtual environment manager (to replace magic)https://pixi.sh/latest/
modularCompany, platform, suite of AI libraries and toolshttps://www.modular.com/
maxGenAI graph compilerhttps://docs.modular.com/max/intro
mojoProgramming languagehttps://docs.modular.com/mojo/manual/

Update pixi

To update pixi, you can run the following command in your terminal:

bash
pixi self-update

Remove pixi

To remove Pixi, you can run the following command in your terminal:

bash
rm ~/.pixi/bin

Install Mojo extension in VS Code

To install Mojo extension in VS Code, you can search for "Mojo" in the "Extensions: Marketplace" Tab. You can also assess it via the link https://marketplace.visualstudio.com/items?itemName=modular-mojotools.vscode-mojo.

There are two versions of the extension: Mojo and Mojo (nightly). The first one is the stable version. For now, I recommend you to use the stable version, unless you want to try the latest features of Mojo.

Mojo Miji - A Guide to Mojo Programming Language from A Pythonista's Perspective · 魔咒秘籍 - Pythonista 視角下的 Mojo 編程語言指南