Skip to content
Related Articles
Get the best out of our app
GeeksforGeeks App
Open App

Related Articles

How to Install Rust in MacOS?

Improve Article
Save Article
Like Article
Improve Article
Save Article
Like Article

Rust is a general-purpose programming language. It is an extremely fast and powerful programming language. It is best known for system language. It is built for the system rather than application programming languages and it is used to build up some drivers and compilers. It is also used to build operating systems and browser components. It gives all the controls that we can have and all the levels of security that we can achieve. It is generally used for performance-critical services while guaranteeing memory safety and thread safety, empowering developers to debug at compile-time.


  • It is easy to download and install in any operating system like Windows, macOS, Linux, etc.
  • Rust is the fast and powerful programming language.
  • Rust has a friendly compiler with useful error messages.
  • It provides the zero-cost abstraction means we can add abstraction without affecting the performance of the code.
  • It provides type inference.
  • It provides safe memory allocation.
  • It provides Quick debugging and testing

Installing Rust in MacOS

To install Rust in MacOS we need to follow the following steps:

Step 1: Go to the official website using the URL and copy the following code:

curl –proto ‘=https’ –tlsv1.2 -sSf | sh


Step 2: Open the terminal and paste the above command. Wait for some time.


Step 3: Choose option 1 and press enter for the installation process.


Step 4: Now, Rust has been installed. So restart the terminal window and write the following command to check the current version of the Rust.

rustc –version


Hence, Rust installed successfully in your system.

Simple program in Rust

To run a simple Rust program in the terminal we need to follow the following steps:

Step 1: Create a directory to store Rust projects using the following command:

mkdir ~/rustprojects

cd ~/rustprojects

Step 2: In this main directory we create a subdirectory that stores our simple program.

mkdir Firstprogram 

cd Firstprogram

Step 3: Now we create a file named “” using any text editor and write the following code in it:


// Simple Rust program
fn main() {
    println!("Welcome to Rust");

Save this file in the Firstprogram directory.

Step 4: Now we run this code in the terminal using the following commands:



and you get the following output:


My Personal Notes arrow_drop_up
Last Updated : 14 Oct, 2022
Like Article
Save Article
Similar Reads
Related Tutorials