Rust: Write and Run Hello World! Program Example

  1. Open a Text Editor (Notepad/Notepad++/TextEdit or Sublime based on your OS).
  2. Write the following to it.
    fn main() {
        println!("Hello World!");
  3. Save the file as
Writing Hello World Rust Lang Program in Mac TextEdit

Steps to Run the "Hello World!" Rust Program

  1. Open Terminal (if on Mac/Linux/Ubuntu) or Command Prompt (if on Windows)
  2. Move to the location where you have created the file.
  3. Run the command: rustc to compile our "Hello World!" program.
  4. Finally, we are good to run our program,
  5. Output:

    Hello World!

Rust - Running Hello World Program on Mac

Facing issues? Have Questions? Post them here! I am happy to answer!

Author Info:

Rakesh (He/Him) has over 14+ years of experience in Web and Application development. He is the author of insightful How-To articles for Code2care.

Follow him on: X

You can also reach out to him via e-mail:

Copyright © Code2care 2024 | Privacy Policy | About Us | Contact Us | Sitemap