Mojo🔥 is now available on Mac

October 19, 2023

Shashank Prasanna

AI Developer Advocate

It's finally here!

We released Mojo local download for Linux systems on September 7th, and in just over a month we’ve seen tens of thousands of downloads and amazing community projects such as llama.🔥and Infermo. We deeply value your feedback, as Mojicians, and we appreciate every single PR, feature request, and bug report. Some trends are easy to track, and from all the feedback we received, one request stood out on Discord, on social media and was the most upvoted feedback on GitHub:

We heard you loud and clear, and today, we are excited to share that Mojo is now available on Mac (Apple silicon) 🎉

In this blog post, we’ll discuss how you can get started with the Mojo SDK on Mac. We'll take a closer look at how to download and install the Mojo SDK on your Mac, and share popular community projects and resources to help you start your Mojo learning journey. We can’t wait to see what you’ll build. For a deeper dive on components of the Mojo SDK be sure to check out our launch blog post.

NOTE: This guide is for Mojo on Apple Silicon-based Macs only. Mojo on Intel-based Macs can be installed via Docker containers. Select “Set up on Mac (Intel)” in the developer console for instructions.

Getting started with Mojo SDK

Here are 6 quick steps to experience the power of Mojo on Mac:

  1. First head over to the Modular developer console and sign in or create an account. 
  2. Once you’re signed in, select “Set up on Mac” to see install instructions for Mac
  3. You will need the Homebrew package manager to download the Modular CLI. If you don’t already have Homebrew, you can install it from here
  4. With Homebrew installed, follow the instructions on the developer console to install Modular CLI using your authentication code.
  5. Use the modular CLI to install Mojo with modular install mojo
  6. Finally, follow the instructions on the output to add Mojo to path on your shell

You are now ready to run your first “Hello Mojo🔥” program using the Mojo REPL. Run :q to exit the REPL environment.

Get the Visual Studio Code extension for Mojo SDK

Visual Studio Code is one of the most popular IDEs in the world, and Mojo supports it directly with an official extension on the Visual Studio Marketplace. The extension supports syntax highlighting, diagnostics, definitions and references, hover help, formatting, and code completion.

Watch this video for an overview of using the Mojo🔥 Visual Studio Extension 🚀

Mojo SDK on Mac is ⚡fast ⚡

Time for some benchmarking. Open a terminal window and clone the Mojo examples repository:

Bash

$ git clone https://github.com/modularml/mojo.git
$ cd mojo/examples

Let’s run a matrix multiplication example using matmul.mojo. On My Apple MacBook Pro M2 Max, I get about 90,000x speedup over pure Python 🤯

Mojo can take full advantage of Mac CPU cores and vector units to achieve these speedups. Read our blog post series on speeding up Mandelbrot code for tips and tricks to vectorize and parallelize Mojo code to accelerate your applications.

Experience the awesomeness of Mojo🔥 community projects ❤️

In just over a month, Mojo community members have built and contributed amazing projects. Community member and mojician Vilson has compiled a list of popular Mojo projects, so you can get started quickly: https://github.com/mojicians/awesome-mojo

One of the most popular community projects is llama2.mojo by community member Aydyn Tairov with over 1.2k stars on GitHub. You can read all about Aydyn’s journey from discovering Mojo to building llama2.mojo in his blog post: How I built llama2.mojo. Llama2.mojo is blazing fast on the Mac and delivers ~960 tok/s. 

Next steps

We’re really excited about bringing Mojo to the Mac user community. We hope you try it out and share your feedback. Here are other ways to get involved:

Don’t forget to tune in to Modular Community Livestream - Mojo🔥 on Mac on Friday, Oct 20th. We’ll discuss all things Mojo🔥 on Mac and walk you through getting started, discuss Mac-specific features, and share how to build and run Mojo applications on any host! We have a lot of cool demos and a guest speaker.

Lastly, if you were in our Discord last night - you'll have found our Easter Egg 🥚 - we gave our Discord community access to Mojo 🔥 on Mac early! Join the Discord now for future early access.

Shashank Prasanna
,
AI Developer Advocate