Mojo looks pretty exciting so here’s how i got it working on my machine, good luck!
Open your terminal.app
Install homebrew (if it isn’t already installed):
/bin/bash -c "$(curl -fsSL <https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh>)"
Then install python version 3.11 (currently the highest supported version by Mojo)
brew install python@3.11
Then add the python executables to your path:
echo 'export PATH="/opt/homebrew/opt/python@3.11/libexec/bin:$PATH"' >> ~/.zshrc \
&& source ~/.zshrc
pipx - Install and Run Python Applications in Isolated Environments:
brew install pipx
pipx ensurepath
sudo pipx ensurepath --global
Change to your workspace directory OR use this code to create a development folder in your home directory:
mkdir ~/Development && cd ~/Development
Ensure that you get something like “Python 3.11.9” when you run:
python3 --version
It may have a different Patch Level 3.11.x, like 3.11.10 as long as it is 3.11 or the latest supported version by mojo.
Install Mojo
curl -s https://get.modular.com | sh -
Activate a python venv for mojo
python3 -m venv mojo-venv && source mojo-venv/bin/activate
Then install mojo via the modular package manager:
modular install mojo
And add required modular and mojo to your path:
MOJO_PATH=$(modular config mojo.path) \
&& echo 'export MODULAR_HOME="'$HOME'/.modular"' >> ~/.zshrc \
&& echo 'export PATH="'$MOJO_PATH'/bin:$PATH"' >> ~/.zshrc \
&& source ~/.zshrc
Now you should be able to run the mojo repl
mojo repl
And get something like this:
Welcome to Mojo! 🔥
Expressions are delimited by a blank line.
Type `:quit` to exit the REPL and `:mojo help` for further assistance.
1>
Good luck!