Rust Installation Tutorial
1/19/2023 by Junxiao Guo

Rust is a multi-paradigm, high-level, general-purpose programming language. Rust emphasizes performance, type safety, and concurrency. Rust enforces memory safety—that is, that all references point to valid memory—without requiring the use of a garbage collector or reference counting present in other memory-safe languages.

This article goes through how to install cargo on you local machine and tutorial on mirror settings if you are located in China.


The official Rust document website is

Rustup: the Rust installer and version management tool

The primary way that folks install Rust is through a tool called Rustup, which is a Rust installer and version management tool.

It looks like you’re running macOS, Linux, or another Unix-like OS. To download Rustup and install Rust, run the following in your terminal, then follow the on-screen instructions. See "Other Installation Methods" if you are on Windows.

curl --proto '=https' --tlsv1.2 -sSf | sh

If you need to update your Rust, you can simply enter rustup update.

Mirror settings for users in China

  1. Go to folder /Users/{yourname}/.cargo/ (create one if you don't have it yet)
  2. Create a file named config.toml
  3. Add the following content to config.toml
[source.crates-io] # Specify the mirror replace-with = 'tuna' # You can replace tuna by ustc or sjtu or rustcc # 中国科学技术大学 [source.ustc] registry = "git://" # 上海交通大学 [source.sjtu] registry = "" # 清华大学 [source.tuna] registry = "" # rustcc社区 [source.rustcc] registry = ""