Installing Rust and coding a small app on your computer
Installing Rust on your computer:
a) Open your terminal and run the following command:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
This will download and run the Rust installation script. Follow the prompts to complete the installation. The installer will ask you to choose an installation profile and an installation directory.
The default options should be fine for most users. Once the installation is complete, you can verify that Rust is installed by running the following command:
rustc --version
This should print the version number of the Rust compiler to the terminal. To update Rust to the latest version, run the following command:
rustup update
Creating a “Hello world” app with Rust
- Open your terminal and create a new Rust project using the following command:
cargo new hello_world
This will create a new directory called hello_world
with the basic structure of a Rust project.
3. Navigate to the project directory:
cd hello_world