To install Rust, the current widely accepted method is to use an installer called rustup. When you visit that website, depending what operating system is detected, you'll have the choice of either downloading an .exe file or running a script in your terminal.
I'll link some videos to show how it can be done, if for example you don't know what a terminal is.
As of March 2023, the instructions to install Rust on an MacOS/Unix that are on the rustup website consist of running the following command in a terminal.:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
The rustup website presents the same information as the official Rust website.
While much can be said about the dangers of piping a bash script from the internet into your command line, it is beyond the scope of this website/guide. One thing that is for sure is that this problem exists for whatever you have to install.
Of course you can read the code by running
curl -s https://sh.rustup.rs | vi -to see what's inside.
As of March 2023, the instructions to install Rust on an Windows that are on the rustup website consist of downloading and installing the
Verifying the installation works the same on all the systems. Open a command prompt or terminal and run:
rustc --version # Should output something like # rustc 1.66.1 (90743e729 2023-01-10) cargo --version # Should output something like # cargo 1.66.1 (ad779e08b 2023-01-10)
If both these commands ran properly, there are high chances that everything worked properly. If it didn't, which Murphy's Law ensures might happen, reach out per email and I'll help you.
- It is possible to either use
brewfor MacOS or
chocolateyfor Windows or
apton Unix, however, I do not recommend using those if you're just starting up. The reason is that you might end up getting a version that is either outdated or not properly configured.
- It is possible to run all of your code in Docker, but at this stage it is completely unnecessary since we're just starting up.
- Remember how we were running code in the browser previously? The trick is that this website is using the Rust Playground behind the scenes to run the code there and display the output here. You can continue working in the Playground without installing anything, unfortunately though, that website doesn't contain all the packages we will need going forward. Besides, now you have your Rust on your own machine, nobody can take it away!
- To uninstall or remove the Rust toolchain from your system, you can run
rustup self uninstallbut you won't do that just now, right? Right!? 👻