• Skip to main content
  • Skip to after header navigation
  • Skip to site footer

Free-Mail

  • Events
  • Images
    • Instagram Goodness
  • Music
  • News
  • Software

Manage your Rust toolchain using rustup

Manage your Rust toolchain using rustup: Manage your Rust toolchain using rustup Gaurav Kamathe Wed, 06/22/2022 – 03:00

1 reader likes this
1 reader likes this

The Rust programming language is becoming increasingly popular these days, used and loved by hobbyists and corporations alike. One of the reasons for its popularity is the amazing tooling that Rust provides making it a joy to use for developers. Rustup is the official tool used to manage Rust tooling. Not only can it be used to install Rust and keep it updated, it also allows you to seamlessly switch between the stable, beta, and nightly Rust compilers and tooling. This article will introduce you to rustup and some common commands to use.

Default Rust installation method

If you want to install Rust on Linux, you can use your package manager. On Fedora or CentOS Stream you can use this, for example:

 
$ sudo dnf install rust cargo

This provides a stable version of the Rust toolchain, and works great if you are a beginner to Rust and want to try compiling and running simple programs. However, because Rust is a new programming language it changes fast and a lot of new features are frequently added. These features are part of the nightly and later beta version of the Rust toolchain. To try out these features you need to install these newer versions of the toolchain, without affecting the stable version on the system. Unfortunately, your distro’s package manager can’t help you here.

Installing Rust toolchain using rustup

To get around the above issues, you can download an install script:

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

Inspect it, and then run it. It doesn’t require root privileges and installs Rust accordingly to your local user privileges:

 
$ file sh.rustup.rs
sh.rustup.rs: POSIX shell script, ASCII text executable
$ less sh.rustup.rs
$ bash sh.rustup.rs

Select option 1 when prompted:

 
1) Proceed with installation (default)
2) Customize installation
3) Cancel installation
> 1

After installation, you must source the environment variables to ensure that the rustup command is immediately available for you to use:

 $   source $  HOME/.cargo/env

Verify that the Rust compiler (rustc) and Rust package manager (cargo) are installed:

 
$ rustc --version
$ cargo --version

Programming and development
Red Hat Developers Blog
Programming cheat sheets
Try for free: Red Hat Learning Subscription
eBook: An introduction to programming with Bash
Bash shell scripting cheat sheet
eBook: Modernizing Enterprise Java

See installed and active toolchains

You can view the different toolchains that were installed and which one is the active one using the following command:

 
$ rustup show

Switch between toolchains

You can view the default toolchain and change it as required. If you’re currently on a stable toolchain and wish to try out a newly introduced feature that is available in the nightly version you can easily switch to the nightly toolchain:

 
$ rustup default
$ rustup default nightly

To see the exact path of the compiler and package manager of Rust:

 
$ rustup which rustc
$ rustup which cargo

Checking and Updating the toolchain

To check whether a new Rust toolchain is available:

 $   rustup check

Suppose a new version of Rust is released with some interesting features, and you want to get the latest version of Rust. You can do that with the update subcommand:

 $   rustup update

Help and documentation

The above commands are more than sufficient for day-to-day use. Nonetheless, rustup has a variety of commands and you can refer to the help section for additional details:

 $   rustup --help

Rustup has an entire book on GitHub that you can use as a reference. All the Rust documentation is installed on your local system, which does not require you to be connected to the Internet. You can access the local documentation which includes the book, standard library, and so on:

 
$ rustup doc
$ rustup doc --book
$ rustup doc --std
$ rustup doc --cargo

Rust is an exciting language under active development. If you’re interested in where programming is headed, keep up with Rust!

Rustup can be used to install Rust and keep it updated. It also allows you to seamlessly switch between the stable, beta, and nightly Rust compilers and tooling.

Tools illustration
Image by:

Opensource.com

Rust
Programming

What to read next
5 Rust tools worth trying on the Linux command line
5 signs you might be a Rust programmer

Creative Commons LicenseThis work is licensed under a Creative Commons Attribution-Share Alike 4.0 International License.
Register or Login to post a comment.

: Opensource.com Gaurav Kamathe

Supporting Open Source.

Have you tried: Farking?

Share this:

  • Share on Facebook (Opens in new window) Facebook
  • Share on X (Opens in new window) X
  • Share on Pinterest (Opens in new window) Pinterest
  • Email a link to a friend (Opens in new window) Email
  • More
  • Share on Tumblr (Opens in new window) Tumblr
  • Print (Opens in new window) Print
  • Share on LinkedIn (Opens in new window) LinkedIn
  • Share on Reddit (Opens in new window) Reddit
Published on 22 June 2022 by Alan Category: SoftwareTag: Manage, Rust, rustup, toolchain, Using

NeoLife to empower local entrepreneurship and tackle unemployment on the back of health and wellness trends

August, 2022 Concerned by the rising cost of living and high rate of unemployment in South Africa, …

Read moreNeoLife to empower local entrepreneurship and tackle unemployment on the back of health and wellness trends

evening haze

A nice Bloubergstrand Beach image: evening haze Image by Swiv Bloubergstrand at Twilight Image …

Read moreevening haze

Nice Cape Town 153 photo

Check out this Cape Town image: Cape Town 153 Image by ScubaGeek Image automatically curated and …

Read moreNice Cape Town 153 photo

About Alan

Previous Post:Nice Wanstead Presbyterian Church, Hawkes Bay photo
Next Post:The school Cat Stevens built: how Conservative politicians opposed funding for Muslim schools in England

Reach Trust

Reach Trust is a holding trust for a number of companies within the Stratlec Group.

Copyright © 2026 · Free-Mail · All Rights Reserved · Powered by Straton Electrical

Back to top