Installation - The Rust Programming Language (2024)

Installation

The first step is to install Rust. We’ll download Rust through rustup, acommand line tool for managing Rust versions and associated tools. You’ll needan internet connection for the download.

Note: If you prefer not to use rustup for some reason, please see theOther Rust Installation Methods page for more options.

The following steps install the latest stable version of the Rust compiler.Rust’s stability guarantees ensure that all the examples in the book thatcompile will continue to compile with newer Rust versions. The output mightdiffer slightly between versions because Rust often improves error messages andwarnings. In other words, any newer, stable version of Rust you install usingthese steps should work as expected with the content of this book.

Command Line Notation

In this chapter and throughout the book, we’ll show some commands used in theterminal. Lines that you should enter in a terminal all start with $. Youdon’t need to type the $ character; it’s the command line prompt shown toindicate the start of each command. Lines that don’t start with $ typicallyshow the output of the previous command. Additionally, PowerShell-specificexamples will use > rather than $.

Installing rustup on Linux or macOS

If you’re using Linux or macOS, open a terminal and enter the following command:

$ curl --proto '=https' --tlsv1.2 https://sh.rustup.rs -sSf | sh

The command downloads a script and starts the installation of the rustuptool, which installs the latest stable version of Rust. You might be promptedfor your password. If the install is successful, the following line will appear:

Rust is installed now. Great!

You will also need a linker, which is a program that Rust uses to join itscompiled outputs into one file. It is likely you already have one. If you getlinker errors, you should install a C compiler, which will typically include alinker. A C compiler is also useful because some common Rust packages depend onC code and will need a C compiler.

On macOS, you can get a C compiler by running:

$ xcode-select --install

Linux users should generally install GCC or Clang, according to theirdistribution’s documentation. For example, if you use Ubuntu, you can installthe build-essential package.

Installing rustup on Windows

On Windows, go to https://www.rust-lang.org/tools/install and followthe instructions for installing Rust. At some point in the installation, you’llbe prompted to install Visual Studio. This provides a linker and the nativelibraries needed to compile programs. If you need more help with this step, seehttps://rust-lang.github.io/rustup/installation/windows-msvc.html

The rest of this book uses commands that work in both cmd.exe and PowerShell.If there are specific differences, we’ll explain which to use.

Troubleshooting

To check whether you have Rust installed correctly, open a shell and enter thisline:

$ rustc --version

You should see the version number, commit hash, and commit date for the lateststable version that has been released, in the following format:

rustc x.y.z (abcabcabc yyyy-mm-dd)

If you see this information, you have installed Rust successfully! If you don’tsee this information, check that Rust is in your %PATH% system variable asfollows.

In Windows CMD, use:

> echo %PATH%

In PowerShell, use:

> echo $env:Path

In Linux and macOS, use:

$ echo $PATH

If that’s all correct and Rust still isn’t working, there are a number ofplaces you can get help. Find out how to get in touch with other Rustaceans (asilly nickname we call ourselves) on the community page.

Updating and Uninstalling

Once Rust is installed via rustup, updating to a newly released version iseasy. From your shell, run the following update script:

$ rustup update

To uninstall Rust and rustup, run the following uninstall script from yourshell:

$ rustup self uninstall

Local Documentation

The installation of Rust also includes a local copy of the documentation sothat you can read it offline. Run rustup doc to open the local documentationin your browser.

Any time a type or function is provided by the standard library and you’re notsure what it does or how to use it, use the application programming interface(API) documentation to find out!

Installation - The Rust Programming Language (2024)
Top Articles
How to short the US dollar
Number of 401(k) Millionaires Hits Record
Katie Pavlich Bikini Photos
Gamevault Agent
Hocus Pocus Showtimes Near Harkins Theatres Yuma Palms 14
Free Atm For Emerald Card Near Me
Craigslist Mexico Cancun
Hendersonville (Tennessee) – Travel guide at Wikivoyage
Doby's Funeral Home Obituaries
Vardis Olive Garden (Georgioupolis, Kreta) ✈️ inkl. Flug buchen
Select Truck Greensboro
How To Cut Eelgrass Grounded
Pac Man Deviantart
Alexander Funeral Home Gallatin Obituaries
Craigslist In Flagstaff
Shasta County Most Wanted 2022
Energy Healing Conference Utah
Testberichte zu E-Bikes & Fahrrädern von PROPHETE.
Aaa Saugus Ma Appointment
Geometry Review Quiz 5 Answer Key
Walgreens Alma School And Dynamite
Bible Gateway passage: Revelation 3 - New Living Translation
Yisd Home Access Center
Home
Shadbase Get Out Of Jail
Gina Wilson Angle Addition Postulate
Celina Powell Lil Meech Video: A Controversial Encounter Shakes Social Media - Video Reddit Trend
Walmart Pharmacy Near Me Open
Dmv In Anoka
A Christmas Horse - Alison Senxation
Ou Football Brainiacs
Access a Shared Resource | Computing for Arts + Sciences
Pixel Combat Unblocked
Umn Biology
Cvs Sport Physicals
Mercedes W204 Belt Diagram
Rogold Extension
'Conan Exiles' 3.0 Guide: How To Unlock Spells And Sorcery
Teenbeautyfitness
Weekly Math Review Q4 3
Facebook Marketplace Marrero La
Nobodyhome.tv Reddit
Topos De Bolos Engraçados
Gregory (Five Nights at Freddy's)
Grand Valley State University Library Hours
Holzer Athena Portal
Hampton In And Suites Near Me
Stoughton Commuter Rail Schedule
Bedbathandbeyond Flemington Nj
Free Carnival-themed Google Slides & PowerPoint templates
Otter Bustr
Selly Medaline
Latest Posts
Article information

Author: Delena Feil

Last Updated:

Views: 5899

Rating: 4.4 / 5 (65 voted)

Reviews: 88% of readers found this page helpful

Author information

Name: Delena Feil

Birthday: 1998-08-29

Address: 747 Lubowitz Run, Sidmouth, HI 90646-5543

Phone: +99513241752844

Job: Design Supervisor

Hobby: Digital arts, Lacemaking, Air sports, Running, Scouting, Shooting, Puzzles

Introduction: My name is Delena Feil, I am a clean, splendid, calm, fancy, jolly, bright, faithful person who loves writing and wants to share my knowledge and understanding with you.