Adding the Mojo Package
Install Mojo through the Modular toolchain.
Adding the Mojo Package is a free Mojo Academy lesson on CoddyKit — lesson 2 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the Mojo Academy learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.
The CLI Is Not Mojo Yet
Installing magic gave you the manager, not the language. Now you add Mojo itself into a project through that toolchain. 📦
Projects Hold Your Toolchain
With magic, Mojo lives inside a project folder. Each project gets its own pinned version, so different apps never clash.
Create a New Project
Start by making a project. The magic init command scaffolds a folder ready to hold Mojo and its dependencies.
magic init my-mojo-appStep Into the Folder
Move into the new directory so the next commands run in the right place. This folder is your project root.
cd my-mojo-appAdd the Mojo Package
Pull Mojo into the project with magic add. This downloads the compiler and standard library as a package the project depends on.
magic add mojoThe Manifest File
Your dependencies are tracked in a pixi.toml manifest. Adding mojo records it there so the setup is reproducible later.
The Lock File
Alongside the manifest sits a lock file pinning exact versions. It guarantees teammates get the very same toolchain you have.
Enter the Environment
Activate the project so its tools are on your PATH. Inside a magic shell, the mojo command becomes available to you.
magic shellRun Without Activating
Prefer not to enter a shell? Prefix any command with magic run to use the project's Mojo for just that one command.
magic run mojo --versionMojo Is Now Local
Because Mojo lives in the project, deleting the folder removes it cleanly. Nothing is scattered globally across your system.
Share It with Others
Commit pixi.toml and the lock file to git. A teammate then runs magic install to recreate the exact same Mojo setup.
magic installQuick Check
Recall the command that pulls Mojo into your project after you create it.
Recap
You ran magic init, then magic add mojo, and the package landed in pixi.toml. Enter it with magic shell to use mojo. 🎯
Frequently asked questions
Is the “Adding the Mojo Package” lesson free?
Yes — the full text of “Adding the Mojo Package” is free to read here on the web, and the Mojo Academy course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the Mojo Academy course, upgrade to CoddyKit PRO.
What will I learn in “Adding the Mojo Package”?
Install Mojo through the Modular toolchain. You practise Mojo Academy with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.
Do I need any experience to start Mojo Academy?
No prior experience is required. Mojo Academy on CoddyKit is structured for beginners through advanced learners; this is — lesson 2 of 4, so you can start here or from the beginning and move at your own pace.
How long does the “Adding the Mojo Package” lesson take?
Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.
Can I write and run code in this Mojo Academy lesson?
Yes. Every Mojo Academy lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.
All lessons in this course
- Installing the Modular CLI
- Adding the Mojo Package
- Checking Your Version
- Your Editor Setup for Mojo