So you want to run Mojo on Windows. Brave choice but totally doable. This short guide will get the Mojo toolchain installed, the PATH configured, a tiny mojo app created, and a successful run confirmed. Expect a little clicking, a little command line, and a small victory dance when your Hello message shows up.
Prepare the system
Before you start throw on the basics. Mojo likes a modern development environment. At minimum have a supported Python version installed and access to a developer command prompt.
If you want fewer surprises pick the Windows Subsystem for Linux. WSL gives you a Unix like shell and makes many tooling steps smoother if you come from Linux or macOS.
Install the Mojo toolchain
Follow the Modular documentation to grab the official distribution or use the installer if one is provided. The installer will place the compiler and package manager on your system so you can actually write and run code instead of staring at the README.
After the installer finishes open a terminal and confirm the basics with a quick version check. If the command responds you are past the first hurdle.
mojo --version
Configure environment variables
Make the mojo command available globally by adding the toolchain bin folder to your PATH. You can do this from Windows system settings which is the safe option, or from an elevated terminal if you like living dangerously.
Example using the setx command in a command prompt with admin rights. Replace the path with your actual install path.
setx PATH "%PATH%;C:\path\to\mojo\bin"
Close and reopen your terminal after changing PATH so the new value takes effect.
Create a new project and write a simple Mojo app
Create a project folder and put a single source file in it named main.mojo. A minimal project is perfectly fine while you are learning.
mkdir my_mojo_app
cd my_mojo_app
notepad main.mojo
Put a tiny example in main.mojo. Keep it short so compile and run cycles are fast while you learn the language and tools.
# main.mojo
print("Hello from Mojo on Windows")
Run and verify
From the project folder run the runtime command to compile and execute the file. You will usually see a build step followed by the program output.
mojo run main.mojo
If you still want to confirm the toolchain is healthy use the version command again and check that the output matches what the installer promised.
Troubleshooting tips
- If mojo is not found double check PATH and restart your terminal session.
- If the run fails read the logs. Missing libraries or runtime errors usually tell you what is wrong.
- If you used WSL remember the toolchain installed in Windows may not be available inside a WSL distro and vice versa. Install inside the environment you plan to run from.
- When in doubt consult the Modular docs and the mojo tutorial pages for platform specific notes.
There you go. You installed Mojo on Windows, configured a usable development setup, wrote a tiny mojo app, and ran it. Now go build something that makes your coffee or at least prints something clever.