Solve the problem that Rust - update crates.io is too slow

After a series of operations, scientific methods such as surfing the Internet, the personal test is invalid. I thought of changing the rust file source to speed up

First enter the cargo directory of your computer, MAC OS is installed by default under ~/.cargo:

cd ~/.cargo

Create a config file, here use the vim editor:

vim config

If it shows insufficient authority, you can chmod xxx 777, or use sudo su, or sudo vim config! ! !
After entering the editing interface, type i to switch to insert mode and
paste the following code:

# 放到 `$HOME/.cargo/config` 文件中
[source.crates-io]
registry = "https://github.com/rust-lang/crates.io-index"

# 替换成你偏好的镜像源
replace-with = 'sjtu'
#replace-with = 'ustc'

# 清华大学
[source.tuna]
registry = "https://mirrors.tuna.tsinghua.edu.cn/git/crates.io-index.git"

# 中国科学技术大学
[source.ustc]
registry = "git://mirrors.ustc.edu.cn/crates.io-index"

# 上海交通大学
[source.sjtu]
registry = "https://mirrors.sjtug.sjtu.edu.cn/git/crates.io-index"

# rustcc社区
[source.rustcc]
registry = "git://crates.rustcc.cn/crates.io-index"

Then press esc, enter: wq to save and exit, try again now, is it faster to fry chicken? ! ! !

Guess you like

Origin blog.csdn.net/m0_46159309/article/details/108732347
Recommended