Skip to content

Installation

JavaScript developers are familiar with Node.js and npm for building JavaScript applications. Similarly, Rust has its own toolchain that we’ll install in this guide.

Installing Rust

The recommended way to install Rust is through rustup:

On macOS and Linux
Terminal window
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
On Windows

Download and run the installer from rustup.rs.

Verifying Installation

After installation, verify that Rust is installed correctly:

Terminal window
rustc --version
cargo --version

Updating Rust

To update Rust to the latest version:

Terminal window
rustup update

Uninstalling Rust

To uninstall Rust:

Terminal window
rustup self uninstall

IDE Setup

VS Code

Install the “rust-analyzer” extension for the best Rust development experience.

IntelliJ IDEA

Install the “Rust” plugin for IntelliJ IDEA.

Understanding the Rust Toolchain

When you install Rust through rustup, you get several important tools:

  1. rustc: The Rust compiler (similar to Node.js’s V8 engine)
  2. cargo: Rust’s package manager and build system (similar to npm/yarn)
  3. rustup: The toolchain installer and manager itself

JavaScript Equivalents

JavaScript EcosystemRust Ecosystem
noderustc
npm / yarncargo
nvmrustup
package.jsonCargo.toml
node_modules/target/
npxcargo run

Integrated Development Environment (IDE)

Most JavaScript developers are used to excellent editor support. For Rust, the best experience is currently with:

Visual Studio Code

If you’re already using VS Code for JavaScript, you can add Rust support:

  1. Install the rust-analyzer extension
  2. Optionally install CodeLLDB for debugging
Other Editors
  • JetBrains IDEs: Use the Rust plugin or the dedicated RustRover
  • Vim/Neovim: Use rust-analyzer with CoC or built-in LSP
  • Emacs: Use rust-analyzer with Eglot or LSP-mode

Setting Up Your First Project

Now that you have Rust installed, you can create your first Rust project using Cargo!

Troubleshooting

Missing Compiler Tools on Windows

If you’re on Windows and encounter errors about missing tools, you might need to install the Microsoft C++ Build Tools.

Path Issues

If you get “command not found” errors, ensure that ~/.cargo/bin is in your PATH.

Getting Help

If you encounter any issues, the Rust community is very helpful:

Conclusion

You’re now ready to start developing in Rust!