Mojo Programming: Mojo Installation and Setup – 1

Hello Learners…

Welcome to the blog…

Table Of Contents

  • Introduction
  • Mojo Programming: Mojo Installation and Setup – 1
    • 1. Mojo Installation and Setup
  • Summary
  • References

Introduction

This is the series of Mojo Programming: A Comprehensive Guide to Learning and Implementation. In which we try to learn the concepts of Mojo Programming Language.

Mojo Programming: Mojo Installation and Setup – 1

In this guide, we are trying to follow all the below steps using Mojo Programming Language.

1. Mojo Installation and Setup
2. Mojo Basic
3. String, List, Indexing
4. Tuple, Set & Dict
5. If, Else & For Loop
6. For Loops & While loops
7. Functions
8. Logging And Debugging
9. Iterator Generator
10. File System
11.  Class And Objects
12. Module & Packages
13. Exception handling
14. Abstraction And Inheritance
15. Encapsulation And Polymorphism

In this tutorial, we are using Linux OS And VSCode for programming.

1. Mojo Installation and Setup

Verify your computer meets the system requirements

  • + Ubuntu 20.04 and later
  • + x86-64 CPU and minimum 4 GiB RAM
  • + Python 3.8 – 3.10
  • + g++ or clang++ compiler

Install the Modular CLI:

curl https://get.modular.com | \
  MODULAR_AUTH=YOUR_AUTH \
  sh -

And hit the enter…

Mojo Programming: Learning and Implementation - 1
Mojo Programming: Learning and Implementation - 1

Install the Mojo SDK:

modular install mojo
Mojo Programming: Learning and Implementation - 1

Now run the following commands if you are using bash:

echo 'export MODULAR_HOME="/home/galaxyofai/.modular"' >> ~/.bashrc
echo 'export PATH="/home/galaxyofai/.modular/pkg/packages.modular.com_mojo/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc

If you are using ZSH, run the following commands:

echo 'export MODULAR_HOME="/home/galaxyofai/.modular"' >> ~/.zshrc
echo 'export PATH="/home/galaxyofai/.modular/pkg/packages.modular.com_mojo/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc

First, let’s try running some code in the Mojo REPL, which allows you to write and run Mojo code directly in a command prompt:

  1. To start a REPL session, type mojo in your terminal and press Enter.
  2. Then type print("Hello, world!") and press Enter twice (a blank line is required to indicate the end of an expression).

That is all for the first step that we have to do…

Summary

This introductory step allows you to confirm that your Mojo installation is functioning correctly and provides a simple starting point for further exploration and development within the Mojo environment.

Happy learning And Keep Learning

Thank you…

References

Leave a Comment