Failed to install rustup

I was trying to reinstall rust due to an issue relating to cargo not being able to access the package index, but when I came back to reinstall it, I got this error:

user@comuter downloads % curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
info: downloading installer
/var/folders/sv/cfwtdbss7vs_wnghz4_scjd40000gt/T/tmp.gHo7RtjC/rustup-init: line 2: syntax error near unexpected token `newline'
/var/folders/sv/cfwtdbss7vs_wnghz4_scjd40000gt/T/tmp.gHo7RtjC/rustup-init: line 2: `<!DOCTYPE html>'

user@comuter downloads % rustup-init -v -y
info: profile set to 'default'
info: default host triple is x86_64-apple-darwin
verbose: installing toolchain 'stable-x86_64-apple-darwin'
verbose: toolchain directory: '/Users/trenten_miller/.rustup/toolchains/stable-x86_64-apple-darwin'
info: syncing channel updates for 'stable-x86_64-apple-darwin'
verbose: creating temp file: /Users/trenten_miller/.rustup/tmp/_g2oia8imf_js606_file
verbose: downloading file from: 'https://static.rust-lang.org/dist/channel-rust-stable.toml.sha256'
verbose: downloading with reqwest
verbose: deleted temp file: /Users/trenten_miller/.rustup/tmp/_g2oia8imf_js606_file
verbose: no update hash at: '/Users/trenten_miller/.rustup/update-hashes/stable-x86_64-apple-darwin'
verbose: creating temp file: /Users/trenten_miller/.rustup/tmp/xa31testt2ge_l7p_file.toml
verbose: downloading file from: 'https://static.rust-lang.org/dist/channel-rust-stable.toml'
verbose: downloading with reqwest
verbose: deleted temp file: /Users/trenten_miller/.rustup/tmp/xa31testt2ge_l7p_file.toml
info: update not yet available, sorry! try again later
verbose: toolchain is already up to date
error: toolchain 'stable-x86_64-apple-darwin' is not installable

user@comuter downloads % rustup-init -V
rustup-init 1.26.0 (5af9b9484 2023-04-05)

user@comuter downloads %

What went wrong? How can I complete the install?

UPDATE: Found a way to cause the instillation to succeed! Here is the command logs:

user@computer Downloads % ./rustup-init --no-update-default-toolchain -v -y
info: profile set to 'default'
info: default host triple is x86_64-apple-darwin
info: updating existing rustup installation - leaving toolchains alone


Rust is installed now. Great!

To get started you may need to restart your current shell.
This would reload your PATH environment variable to include
Cargo's bin directory ($HOME/.cargo/bin).

To configure your current shell, run:
source "$HOME/.cargo/env"
user@computer Downloads % source "$HOME/.cargo/env"
user@computer Downloads % rustc -V
error: rustup could not choose a version of rustc to run, because one wasn't specified explicitly, and no default is configured.
help: run 'rustup default stable' to download the latest stable release of Rust and set it as your default toolchain.
user@computer Downloads % rustup -v default stable
verbose: read metadata version: '12'
verbose: looking for installed toolchain 'stable-x86_64-apple-darwin'
verbose: installing toolchain 'stable-x86_64-apple-darwin'
verbose: toolchain directory: '/Users/trenten_miller/.rustup/toolchains/stable-x86_64-apple-darwin'
info: syncing channel updates for 'stable-x86_64-apple-darwin'
verbose: creating temp file: /Users/trenten_miller/.rustup/tmp/yrn875xdnhwo_5r7_file
verbose: downloading file from: 'https://static.rust-lang.org/dist/channel-rust-stable.toml.sha256'
verbose: downloading with reqwest
verbose: deleted temp file: /Users/trenten_miller/.rustup/tmp/yrn875xdnhwo_5r7_file
verbose: no update hash at: '/Users/trenten_miller/.rustup/update-hashes/stable-x86_64-apple-darwin'
verbose: creating temp file: /Users/trenten_miller/.rustup/tmp/07fdnb7pwd6fykfv_file.toml
verbose: downloading file from: 'https://static.rust-lang.org/dist/channel-rust-stable.toml'
verbose: downloading with reqwest
verbose: deleted temp file: /Users/trenten_miller/.rustup/tmp/07fdnb7pwd6fykfv_file.toml
info: update not yet available, sorry! try again later
verbose: toolchain is already up to date
error: toolchain 'stable-x86_64-apple-darwin' is not installable

This is as far as I can go. Any thang that I can do to make this work?

The error message suggests the installer has downloaded some HTML page instead of Rust.

Do you have any software that intercepts network connections? A corporate proxy with a login page, or a very invasive antivirus? If so, that's probably the cause, and the software is blocking your access and replacing binary you download with a web page.

1 Like

You could take a look at this file for more information, it could be a HTTP status page or something similar while it should be the Rust installer.

As far as I know, I do not have that kind of antivirus. This is on a school computer (I do have permission), and the teacher said that there should be no school sanctions preventing me from doing this.

I have tried to find the file, but the installer deletes the file too fast, or it is hidden from view (I do not know to show hidden files and folders on a Mac, and the soonest I will be in front of the computer is Monday.)

What is the output of curl https://static.rust-lang.org/dist/channel-rust-stable.toml.sha256?

Unfortunately, the latest that I will be able to be back on the computer is on Monday. I will get back to you then. But on the computer, they give us homework and other things, with the same software installed, i can download the file just file in my web browser.

School computers are very likely to have some kind of "safety filter" that MITMs TLS, so perhaps even though school's policy is not against installing Rust, it looks like school's network filter blocks it anyway.

There are archives with full Rust installation that you could download via browser:

The second output that I have on the topic is from the secondary method (downloading rustup-init directly from the website). I have also tried the .pkg offline installer, but that required admin privileges.

The command has no output on the computer. Why would this be?

do you mean the command given by bjorn3?

if so, there is definitely a network connection problem on your side. either your computer is misconfigured (like proxy, dns, etc), or your school network has a policy to block the contents (for whatever reasons). try contact local technician or administrator for help.

another alternative to "rustup" and "offline installer package" is docker images, if you environment doesn't block docker, you may try one of the official rust docker images, most likely you'll want the "latest" tag if you don't have particular version requirements.

Can you try curl -v https://static.rust-lang.org/dist/channel-rust-stable.toml.sha256? The -v should give information about where the connection went wrong.

I have never had luck with docker before, so I will try again, but I do not expect it to work.

I have tried the command one a different mac (should be connected to the same network) and it has turned out that it is blocked by the school. The strange thing is that I can access it fine through the browser but not through curl. Why would this bee? Can i get curl to work that same way as the browser does without getting blocked?

EDIT: I followed the link by using CMD+click, and opened the link in the browser. Upon opening, it downloading the file as if it was an allowed site? Keep in mind that this is a Seculy link, not the link to the site itself. Any idea on why this is?

If you can download the file https://sh.rustup.rs manually, place it in any folder and execute it with sh yourfilename.

Do you mean the rustup-init file? I have already tried that, and you can see the output of that in the original question. I have also tried installing it manually, but have had no luck. If you know how to install Rust manually, then instructions would be very helpful.

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.