Videos · Rust Fundamentals Applied Program · Week 1
Install Rust and Cargo via rustup on Linux and macOS
rustup installs the Rust toolchain and Cargo by downloading and executing a shell script. The process requires sourcing the cargo environment file to make the rustc and cargo binaries available in the terminal.
Transcript
installing rust is very straightforward i'm using a linux system for this example which will work very well if i use this now this installation method will also work with a mac computer an apple computer if you open up the terminal so that's what we're going to try out but just in case you're not using either linux or you're not using something like a mac computer you can definitely go and take a look at the other supported installers you have the ability to download the rust up in it executable for windows so definitely you have several different options now i'm going to follow up with the command here and i'll go through some of the things that we need to do so i've clicked on on this button to get that whole command copied over it will essentially download a script and then it will execute it with the shell so i'm going to switch over to the terminal i have a running terminal here let's take a look at what type of system i have here in this case i have a linux operating system and to take a look at that i'm going to i'm going to go and look at the contents of os release so in this case it's ubuntu 2004 it's a long-term supported release so so that's fine so it's a deviant based linux operating system so that's fine let's clear that out and paste the commands okay so i've pasted the commands and i have curl here protocol which is https that's fine it's going to use that version of tls it's going to have some extra flags here and i am going to be again downloading that script and executing it on the file this is actually a pipe if you're not familiar with those it will just retrieve the contents and then execute them so i'm going to hit return and what that happens is that there's a download uh the installer gets downloaded and i'm presented with several different options so i'm going to scroll a little bit over to the top i get the welcome to rust i get several different things that will get created on the fly for me some utilities like cargo will have their separate directory we will dive into what cargo is and how it works later but this sets everything up so it's very very convenient some of the things that get updated are going to be in these in these files these configuration files which which will help me get the right path for the tool that i'm installing so let's go ahead and review the options this is going to be using the linux it's going to install the default version of rust profile default is fine and modify variable path variable yes i want to modify the path variable that the commands that i have available in the terminal we get updated to include the rust and all the other rust tools that the installer will get so i'm going to say that i want to continue and proceed with the installation almost always this is the option that you will want to use in some other corner cases you might want to have some custom custom installation that you want to tweak and that's fine you can definitely go ahead and and dive into those but for this lesson we'll just proceed with the regular installation so i'm going to click one or type one and then enter this will take a quick second and let's just wait it out until it completes great rust is now installed and things appear to have completed successfully so how do you verify that this works well the first thing that you might want to say or to do is to type rust c but if you do this right away you will get a command not found why is that because i have a command that i haven't updated my path so my path if i do echo dollar path will not have i know that this is a lot because this is pointing to several different things that have executables but none of these paths here will contain the actual path that contains my rust binaries and all of the extra tooling so what i need to do is run this source home cargo m so let's go ahead and do that and now if i do rust c you will get the whole menu so if i do which rust c to see where this is coming from you will see that this is coming from that cargo bin directory in my home directory so that's uh pretty useful to know and it is the way where we verify how rust uh where where my my binary my executables are installed i'm gonna scroll all the way to the top and you can see here i'm getting the help menu and lots of different options for rust c there are other tools that have been installed as well like cargo so if i say which cargo it will point to the that cargo uh subdirectory in my home directory if i do cargo dash dash help and i clear that and run it again we will get several different uh things there as well for the output so all in all this is a very straightforward way of installing rust and it's a very very concise very very easy to follow especially if you're not tweaking things around and you follow the prompts remember i had to source i had to actually call source on the command line and that made sure that wherever the binaries the executables are installed for the tool chain that i'm working with in rust are going to be available in my system
A new free tutorial every two weeks
Short, practical videos on AI and programming, straight to your inbox. Unsubscribe anytime.