Problem with rust in apple silicon

Hello guys,
I have issue with open rust docs locally, I run this command:
rustup doc

and got this error message:

error: couldn't open browser

error: caused by: command 'open' did not execute successfully; exit code: 1

command stderr:

The file /Users/mehrdad/.rustup/toolchains/beta-aarch64-apple-darwin/share/doc/rust/html/index.html does not exist.

and in VsCode when I try to run my test program got this error when VsCode ask for install some rust package:

Executing task in folder test_test: rustup component add rust-analysis --toolchain beta-aarch64-apple-darwin <

info: component 'rust-analysis' for target 'aarch64-apple-darwin' is up to date

Terminal will be reused by tasks, press any key to close it.

Executing task in folder test_test: rustup component add rust-src --toolchain beta-aarch64-apple-darwin <

info: downloading component 'rust-src'
info: installing component 'rust-src'
info: using up to 500.0 MiB of RAM to unpack components
info: rolling back changes
error: failed to install component: 'rust-src', detected conflict: '"lib/rustlib/src/rust/Cargo.lock"'
The terminal process "/bin/zsh '-c', 'rustup component add rust-src --toolchain beta-aarch64-apple-darwin'" terminated with exit code: 1.

Terminal will be reused by tasks, press any key to close it.

may please guide me to fix this, thank you

I can reproduce this problem. It looks like the rust-docs component is missing from the beta-aarch64-apple-darwin toolchain. It's also missing for the nightly channel. I don't know if this is a known bug.

I can't reproduce this error. The rust-src component installs successfully on my system. Try this command to update your toolchain, in case this was fixed recently:

rustup update

If that doesn't help, try uninstalling and reinstalling the beta toolchain:

rustup toolchain uninstall beta
rustup toolchain install beta

After uninstalling the toolchain, you might want to check whether the ~/.rustup/toolchains/beta-aarch64-apple-darwin directory still exists, and delete it if it does, just to make sure.


Tier 2 platforms do not build documentation.


as I check there is no path for html inside rust folder in this directory:

The file /Users/mehrdad/.rustup/toolchains/beta-aarch64-apple-darwin/share/doc/rust/html/index.html does not exist.

until rust directory is valid but after that is not.

Downloadable documentation is not available on Apple Silicon currently, because it is a Tier 2 platform.

1 Like

So is there any way to build the doc on m1 locally?

You can clone the rust repo, install the required build tools, and build the docs from source with:

./ doc

Or you could download a pre-built toolchain that includes docs:

rustup install stable-x86_64-apple-darwin

and then run rustup +stable-x86_64-apple-darwin doc to open the docs (or copy/symlink the docs from the x86_64 toolchain into the aarch64 toolchain directory). Just be aware that there may be some minor differences between the x86_64 docs and the aarch64 docs.


This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.