Installing the Modular CLI
Get the toolchain onto macOS or Linux.
Installing the Modular CLI is a free Mojo Academy lesson on CoddyKit — lesson 1 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.
Why a Toolchain First
Before you write Mojo, your machine needs the compiler and tools. That bundle is the Modular toolchain, and getting it set up is step one. 🛠️
Meet the Modular CLI
The magic command-line tool from Modular installs and manages everything Mojo needs. Think of it as your toolchain manager.
Pick a Supported System
Mojo runs on macOS and Linux today. On Windows you use WSL, which gives you a Linux environment inside Windows.
Open Your Terminal
Everything here happens in the terminal. On macOS open Terminal, on Linux open your shell, and keep it ready for the next commands.
Run the Install Script
Install the CLI with the official script. This single curl command downloads and sets up the magic tool for you.
curl -ssL https://magic.modular.com/ | bashWhat the Script Does
The script places the magic binary in a local folder and prints a line to add it to your PATH so the shell can find it.
Update Your PATH
Copy the export line the installer shows into your shell config so PATH includes magic in every new terminal you open.
export PATH="$HOME/.modular/bin:$PATH"Reload the Shell
Apply the change by reloading your config or opening a fresh terminal. This is what makes the new magic command available.
source ~/.bashrcConfirm the CLI Works
Check that the install succeeded by asking magic for its version. A version number means the CLI is ready to use.
magic --versionIf the Command Is Not Found
A not-found error almost always means PATH is missing the magic folder. Re-check the export line and reload your terminal.
It Is Safe and Reversible
Everything installs into a local .modular folder in your home directory. To undo it later, you simply delete that folder.
Quick Check
Recall which tool you install first to manage Mojo on your machine.
Recap
You installed Modular's magic CLI with one curl command, fixed your PATH, and confirmed it with magic --version. Toolchain manager ready! 🎯
Frequently asked questions
Is the “Installing the Modular CLI” lesson free?
Yes — the full text of “Installing the Modular CLI” 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 “Installing the Modular CLI”?
Get the toolchain onto macOS or Linux. 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 1 of 4, so you can start here or from the beginning and move at your own pace.
How long does the “Installing the Modular CLI” 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