Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rustup: command not found after installation #686

Closed
camlee opened this issue Aug 24, 2016 · 33 comments
Closed

rustup: command not found after installation #686

camlee opened this issue Aug 24, 2016 · 33 comments

Comments

@camlee
Copy link

camlee commented Aug 24, 2016

After installing rustup using the following:

$ curl -sSf https://static.rust-lang.org/rustup.sh | sh -s -- --channel=nightly

the rustc and cargo commands work:

$ rustc -V
rustc 1.13.0-nightly (3c5a0fa45 2016-08-22)
$ cargo -V
cargo 0.13.0-nightly (41b2177 2016-08-22)

But rustup doesn't:

$ rustup
rustup: command not found

This is on Ubuntu 14.04 32 bit: i686-unknown-linux-gnu I believe.

@hhnr
Copy link

hhnr commented Aug 24, 2016

I'm also getting the same.

rdotdk@rdotdk-laptop ~ $ curl -sf https://static.rust-lang.org/rustup.sh | sudo sh
rustup: gpg available. signatures will be verified
rustup: downloading manifest for 'stable'
rustup: downloading toolchain for 'stable'
######################################################################## 100.0%
gpg: assuming signed data in '/home/rdotdk/.rustup/dl/f7decfef7346bba449da/rust-1.11.0-i686-unknown-linux-gnu.tar.gz'
gpg: Signature made Tuesday 16 August 2016 05:05:09 PM IST using RSA key ID 7B3B09DC
gpg: Good signature from "Rust Language (Tag and Release Signing Key) <rust-key@rust-lang.org>" [unknown]
gpg: WARNING: This key is not certified with a trusted signature!
gpg:          There is no indication that the signature belongs to the owner.
Primary key fingerprint: 108F 6620 5EAE B0AA A8DD  5E1C 85AB 96E6 FA1B E5FE
     Subkey fingerprint: C134 66B7 E169 A085 1886  3216 5CB4 A934 7B3B 09DC
rustup: installing toolchain for 'stable'
rustup: extracting installer
install: creating uninstall script at /usr/local/lib/rustlib/uninstall.sh
install: installing component 'rustc'
install: installing component 'rust-std-i686-unknown-linux-gnu'
install: installing component 'rust-docs'
install: installing component 'cargo'

    Rust is ready to roll.

rdotdk@rdotdk-laptop ~ $ rustc -V
rustc 1.11.0 (9b21dcd6a 2016-08-15)
rdotdk@rdotdk-laptop ~ $ cargo -V
cargo 0.12.0-nightly (6b98d1f 2016-07-04)
rdotdk@rdotdk-laptop ~ $ rustup
rustup: command not found

rdotdk@rdotdk-laptop ~ $ uname -a
Linux rdotdk-laptop 4.4.0-21-generic #37-Ubuntu SMP Mon Apr 18 18:34:49 UTC 2016 i686 i686 i686 GNU/Linux
rdotdk@rdotdk-laptop ~ $ lsb_release -a
No LSB modules are available.
Distributor ID: LinuxMint
Description:    Linux Mint 18 Sarah
Release:    18
Codename:   sarah
rdotdk@rdotdk-laptop ~ $ 

@Boddlnagg
Copy link
Contributor

It looks like you are using rustup.sh, but this repository is about the cross-platform Rust rewrite rustup.rs, which is designed to replace rustup.sh soon, but is not yet officially offered via https://www.rust-lang.org/downloads.html

Please follow the instructions at https://github.com/rust-lang-nursery/rustup.rs#installation to try rustup.rs and let us know if that works!

@hhnr
Copy link

hhnr commented Aug 25, 2016

i followed instructions from https://www.rustup.rs/ and it works. Thanks.

@camlee
Copy link
Author

camlee commented Aug 25, 2016

Ahh. That makes sense. Thanks.

@camlee camlee closed this as completed Aug 25, 2016
@bsed
Copy link

bsed commented Oct 15, 2016

curl https://sh.rustup.rs -sSf | sh
info: downloading installer

Welcome to Rust!

This will download and install the official compiler for the Rust programming
language, and its package manager, Cargo.

It will add the cargo, rustc, rustup and other commands to Cargo's bin
directory, located at:

/home/kelvin/.cargo/bin

This path will then be added to your PATH environment variable by modifying the
profile file located at:

/home/kelvin/.profile

You can uninstall at any time with rustup self uninstall and these changes will
be reverted.

WARNING: This is beta software.

Current installation options:

default host triple: x86_64-unknown-linux-gnu
default toolchain: stable
modify PATH variable: yes

  1. Proceed with installation (default)
  2. Customize installation
  3. Cancel installation
    1

@wilkesreid
Copy link

In my case I needed to add export PATH="$HOME/.cargo/bin:$PATH" to my .bash_profile file instead of my .profile file.

@ledkk
Copy link

ledkk commented Apr 14, 2017

@bsed when i input the number 1 to Proceed with installation, the shell give me a abort message like this :

You can uninstall at any time with rustup self uninstall and these changes will
be reverted.

Current installation options:

   default host triple: x86_64-apple-darwin
     default toolchain: stable
  modify PATH variable: yes

1) Proceed with installation (default)
2) Customize installation
3) Cancel installation
1

info: aborting installation

do you get this error message ? do you know what i should do to install rustup

@ledkk
Copy link

ledkk commented Apr 14, 2017

when i download rustup-init from https://static.rust-lang.org/rustup/dist/x86_64-apple-darwin/rustup-init directlly and execute it , i get another message , it seem to success

You can uninstall at any time with rustup self uninstall and these changes will
be reverted.

Current installation options:

   default host triple: x86_64-apple-darwin
     default toolchain: stable
  modify PATH variable: yes

1) Proceed with installation (default)
2) Customize installation
3) Cancel installation
1

info: syncing channel updates for 'stable-x86_64-apple-darwin'
142.1 KiB / 142.1 KiB (100 %)  95.2 KiB/s ETA:   0 s
info: downloading component 'rustc'
  4.1 MiB /  32.3 MiB ( 13 %)  35.2 KiB/s ETA: 821 s                       

@fschutt
Copy link

fschutt commented Sep 1, 2017

Just a question, but why is rustup.rs not the default? I fall for this every time I have to setup a new computer. Please update the website if possible. I have not run into issues with the rustup.rs installer.

@jchen49gsu
Copy link

jchen49gsu commented Dec 11, 2017

After I type $curl https://sh.rustup.rs -sSf | sh in terminal, I have

Welcome to Rust!

This will download and install the official compiler for the Rust programming 
language, and its package manager, Cargo.

It will add the cargo, rustc, rustup and other commands to Cargo's bin 
directory, located at:

  /Users/jchen6/.cargo/bin

This path will then be added to your PATH environment variable by modifying the
profile files located at:

  /Users/jchen6/.profile
  /Users/jchen6/.bash_profile

You can uninstall at any time with rustup self uninstall and these changes will
be reverted.

Current installation options:

   default host triple: x86_64-apple-darwin
     default toolchain: stable
  modify PATH variable: yes

1) Proceed with installation (default)
2) Customize installation
3) Cancel installation

I choose "1" and then I have

info: syncing channel updates for 'stable-x86_64-apple-darwin'
info: latest update on 2017-11-23, rust version 1.22.1 (05e2e1c41 2017-11-22)
info: downloading component 'rustc'
 33.8 MiB /  33.8 MiB (100 %) 480.0 KiB/s ETA:   0 s                
info: downloading component 'rust-std'
 45.2 MiB /  45.2 MiB (100 %) 476.8 KiB/s ETA:   0 s                
info: downloading component 'cargo'
  2.7 MiB /   2.7 MiB (100 %) 479.8 KiB/s ETA:   0 s                
info: downloading component 'rust-docs'
  4.2 MiB /   4.2 MiB (100 %) 480.0 KiB/s ETA:   0 s                
info: installing component 'rustc'
info: installing component 'rust-std'
info: installing component 'cargo'
info: installing component 'rust-docs'
info: default toolchain set to 'stable'

  stable installed - rustc 1.22.1 (05e2e1c41 2017-11-22)


Rust is installed now. Great!

To get started you need Cargo's bin directory ($HOME/.cargo/bin) in your PATH 
environment variable. Next time you log in this will be done automatically.
To configure your current shell run source $HOME/.cargo/env

I just type $HOME/.cargo/env in the terminal, and everything work now.
check the documents from the website to follow steps
(https://doc.rust-lang.org/book/second-edition/ch01-01-installation.html)

@josephRice
Copy link

This still is broken in Linux.

First

when you edit the .profile you should be putting.

if [ -d "$HOME/.cargo/bin" ] ; then
	PATH="$HOME/.cargo/bin:$PATH"
fi

Regardless of the *nix you should be setting up the system to check if the directory exists before setting up the path. Users do dumb things like delete directories and you don't need a Users .profile to have garbage in their path. Doing the following will do just that.

export PATH="$HOME/.cargo/bin:$PATH"

Second

You should run the following as the very last thing the main() function does.

$(source ~/.profile)    
# or 
# exec source $HOME/.profile
exit

.profile is only evaluated after a login in most cases. Opening a terminal does not re-evaluate .profile that only happens after login. Since you can not always assume that there is a .bash_profile not all users run the same shell. In fact Ubuntu 17.10 is back to having dash as the default system shell, so there is not a .bash_profile at all. doing ether of those will ensure the current terminal session will a the very least have the new $PATH so users don't have log out and back in, or suddenly learn how to set their $PATH to use your program.

Third

This is just a general question? why $HOME/.cargo/bin? why not follow tradition and place user applications in the user bin. I.E. $HOME/bin/cargo/bin etc... and not monkey around with the users profile at all. Just some sage advice from an old timer with 25 years in front of a shell.

Fourth

Full disclosure. Absolutely not a Fan of the Rust programming language. Things like this are just bad practice which adds to my dislike even more. Having random users run a shell script from a URL. Whoa!!!! I guess security is not on your minds. You should be provide a package or download that the first thing it does is check it's self with a MD5 Checksum to ensure that your script wasn't altered along the way.

Here's a design pattern. One of billions of ways to do it.

  • step 1, check thyself bootstrap a md5 checksum on the binary.
  • step 2 phone home download the public check sum for the release.
  • step 3 prompt the user to hit yes if they match.
  • Step 4 set a file attribute to disable the MD5 checksum moving forward on execution or a hidden resource file or create a rustSettings.conf file. To skip over the self check for future executions unless a full upgrade.

if you want ease of install; Users download and click on things. Don't move the cheese. Provide the super easy binary (write it in rust for pete's sake) , then also cater to the people in the know with a psst hey you; yeah you, groovy super/power/non-mouse user, look at this cool thing you can do in the terminal so you don't have to touch your mouse.

Please keep in mind that most users coming to rustup.rs are because of some random github project written in rust and they are not programmers. It seems the rust programming ethos has been lazy, which causes down stream laziness with README.md files with instructions like. go to rustup, clone my project, cd to project sort of instructions run some program then another. Whoops it broke on step one.

rant over, I miss ./configure; make; make install.

@diegogvieira
Copy link

Seriously... this is a joke... this thing is still broken....

@Diggsey
Copy link
Contributor

Diggsey commented Jun 13, 2018

This issue was closed by the original author two years ago, and was an issue related to an entirely different project from this, so anything said here is not going to be seen by anyone. If you want to report a problem, commenting on an unrelated closed issue is not the best way to do that.

If you're still having problems, please check the issue tracker for similar issues and if none exist open a new one.

@josephRice thanks for the detailed write-up, but it would have received more attention if it had been on a relevant issue.

To address your points:

  1. The directory which is added is created by rustup, so there should be no possibility that it doesn't exist, and the entry which rustup adds should be removed again if you uninstall it. Please open an issue relating to this if you want to discuss a better way / PRs are also welcome.

  2. Rustup is a binary rather than a shell script, so in the general case we can't do this. However, we could improve the situation if you are using the shell script: we already do give very clear instructions on how to modify PATH post-install, but it would be nicer to do it automatically where possible. Again, PRs are welcome.

  3. The $HOME/.cargo/bin location was not decided here, please see the lengthy previous discussions about this issue, and the ongoing RFC for following the XDG spec. Ultimately, rustup will follow whatever cargo does here.

  4. Having random users run a shell script from a URL. Whoa!!!!

Again, please see the previous discussions about this. You're running code you've downloaded from the internet, it makes zero difference whether that code is a shell script or a binary.

the first thing it does is check it's self with a MD5 Checksum to ensure that your script wasn't altered along the way.

That would be completely pointless. If anyone was to alter the script along the way, the first thing they'd do is remove the MD5 checking.

Currently we rely on HTTPS for our security: if someone is able to MiTM your HTTPS connection, then they could replace the entire rustup.rs site to begin with, including any GPG keys you might want to validate against, so there is not a lot we can do here that doesn't require manual action from the user.

The most secure option would be to install rust or rustup through your package manager: many distributions already provide packages for this, and rustup has several build options to make it easier for volunteers to provide those packages (such as disabling the self-update feature).

Again, please see the previous discussions, blog posts, etc for a more complete discussions of the options.

rant over, I miss ./configure; make; make install.

As a windows user myself, I don't.

@tungurlakachakcak
Copy link

I had to add the line export PATH="$HOME/.cargo/bin:$PATH" to my /Users/myname/.bashrc file

@sainthkh
Copy link

It's still broken in Ubuntu 18.04.02 LTS. You can fix this manually with @Vallerious's solution.

One more thing: Don't forget to reboot your bash.

@jonschlinkert
Copy link

If you're using zsh, you might also need to add the following to .zshrc

export PATH="$HOME/.cargo/bin:$PATH"

@kemicofa
Copy link

If you installed rust with brew install rust you will not get rustup. Uninstall and re-install rust following documentation.

@uberhacker
Copy link

This issue should be reopened. The latest version of rust (1.36.0 as of this comment) is not working. After installation on an i686 ChromeOS system, I get all zero byte binaries in ~/.cargo/bin. By the way, I fully agree with @josephRice. I see so many projects like this that require the user's path to be modified. I don't understand why this is so popular but it's the WRONG WAY to install an application. See below:

chronos@localhost /usr/local/tmp $ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
info: downloading installer

Welcome to Rust!

This will download and install the official compiler for the Rust programming 
language, and its package manager, Cargo.

It will add the cargo, rustc, rustup and other commands to Cargo's bin 
directory, located at:

  /home/chronos/user/.cargo/bin

This path will then be added to your PATH environment variable by modifying the
profile files located at:

  /home/chronos/user/.profile
  /home/chronos/user/.bash_profile

You can uninstall at any time with rustup self uninstall and these changes will
be reverted.

Current installation options:

   default host triple: i686-unknown-linux-gnu
     default toolchain: stable
  modify PATH variable: yes

1) Proceed with installation (default)
2) Customize installation
3) Cancel installation
>1

info: syncing channel updates for 'stable-i686-unknown-linux-gnu'
info: latest update on 2019-07-04, rust version 1.36.0 (a53f9df32 2019-07-03)
info: downloading component 'rustc'
103.6 MiB / 103.6 MiB (100 %)   8.2 MiB/s in 14s ETA:  0s
info: downloading component 'rust-std'
 61.0 MiB /  61.0 MiB (100 %)   7.7 MiB/s in  9s ETA:  0s
info: downloading component 'cargo'
info: downloading component 'rust-docs'
 11.0 MiB /  11.0 MiB (100 %)   8.3 MiB/s in  1s ETA:  0s
info: installing component 'rustc'
103.6 MiB / 103.6 MiB (100 %)   1.5 MiB/s in  1m 12s ETA:  0s
info: installing component 'rust-std'
 61.0 MiB /  61.0 MiB (100 %)   1.6 MiB/s in 38s ETA:  0s
info: installing component 'cargo'
  4.7 MiB /   4.7 MiB (100 %)   1.7 MiB/s in  3s ETA:  0s
info: installing component 'rust-docs'
 11.0 MiB /  11.0 MiB (100 %) 425.6 KiB/s in 50s ETA:  0s    
info: default toolchain set to 'stable'

  stable installed - (error reading rustc version)


Rust is installed now. Great!

To get started you need Cargo's bin directory ($HOME/.cargo/bin) in your PATH 
environment variable. Next time you log in this will be done automatically.

To configure your current shell run source $HOME/.cargo/env
chronos@localhost ~ $ source $HOME/.cargo/env
chronos@localhost ~ $ cd .cargo/bin/
chronos@localhost ~/.cargo/bin $ ls -la
total 104
drwxr-xr-x  2 chronos chronos 4096 Jul 28 01:31 .
drwxr-xr-x  3 chronos chronos 4096 Jul 28 01:35 ..
-rwxr-xr-x 12 chronos chronos    0 Jul 28 01:31 cargo
-rwxr-xr-x 12 chronos chronos    0 Jul 28 01:31 cargo-clippy
-rwxr-xr-x 12 chronos chronos    0 Jul 28 01:31 cargo-fmt
-rwxr-xr-x 12 chronos chronos    0 Jul 28 01:31 cargo-miri
-rwxr-xr-x 12 chronos chronos    0 Jul 28 01:31 clippy-driver
-rwxr-xr-x 12 chronos chronos    0 Jul 28 01:31 rls
-rwxr-xr-x 12 chronos chronos    0 Jul 28 01:31 rustc
-rwxr-xr-x 12 chronos chronos    0 Jul 28 01:31 rustdoc
-rwxr-xr-x 12 chronos chronos    0 Jul 28 01:31 rustfmt
-rwxr-xr-x 12 chronos chronos    0 Jul 28 01:31 rust-gdb
-rwxr-xr-x 12 chronos chronos    0 Jul 28 01:31 rust-lldb
-rwxr-xr-x 12 chronos chronos    0 Jul 28 01:31 rustup

Also, why does the script download everything twice? Sorry for the rant.

@greed2411
Copy link

greed2411 commented Sep 26, 2019

I tried this on the latest Debian 10, Buster, ended up rustc and cargo not getting recognized, even after logging-out-logging-in, restarting, ended up trying @Vallerious comment up here. It worked.

No .bash_profile or whatever as mentioned in the https://doc.rust-lang.org/book/ch01-01-installation.html

This whole thing didn't happen in ubuntu 18.04 though. It was smooth.

also debian mate is getting treated as x86_64-unknown-linux-gnu.

@kinnison
Copy link
Contributor

Any x86_64 based Linux on glibc will be called that. As for Debian vs. Ubuntu, I'm not sure what's going on there with bash :( if you can work it out, please open a fresh issue about it.

@nsrau
Copy link

nsrau commented Sep 28, 2019

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

  1. Proceed with installation (default)

To configure your current shell run source $HOME/.cargo/env

rustup --version
rustup 1.19.0 (2af131c 2019-09-08)

4.15.0-64-generic #73-Ubuntu SMP Thu Sep 12 13:16:13 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

@astrberg
Copy link

astrberg commented Oct 5, 2019

"rust-client.rustupPath": "~/.cargo/bin/rustup"

@dmyTRUEk
Copy link

It's still broken in Ubuntu 19.10!
You can fix this manually with @Vallerious's solution.
One more thing: Don't forget to reboot your bash.

@alicektx
Copy link

alicektx commented Jan 3, 2020

Compare eg. with Golang...
wget https://dl.google.com/go/go1.13.5.linux-amd64.tar.gz
tar zxvf go1.13.5.linux-amd64.tar.gz
cd go/
mkdir var
export GOROOT=$HOME/go
export GOPATH=$HOME/go/var
export PATH=$PATH:$GOROOT/bin:$GOPATH/bin
export GO111MODULE=on

No pipe curl to .sh, to download binary,which binary then downloads data,
then further exports PATH in quite likely the wrong dotfile.
No unnecessary complexities...all simple & transparent:
download a single tar from a visible url, extract, export. All set.

...JosephRice's "don't move the cheese" part was spot on.
/rant over ;-)

@bensadiku
Copy link

Following the steps at rustup and reloading the terminal with bash --login in Ubuntu fixed it for me.

@simanacci
Copy link

This worked for me on Ubuntu 18.04.
curl https://sh.rustup.rs -sSf | sh
source $HOME/.cargo/env
source ~/.profile

rustup
rustup 1.21.1 (7832b2ebe 2019-12-20)

@Adarshreddyash
Copy link

Ubuntu based systems @simanacci solution works fine.
Installer points this after installation
#To configure your current shell run source $HOME/.cargo/env

@flashtheman
Copy link

flashtheman commented Jun 7, 2020

In Arch Linux I still had to add export PATH="$HOME/.cargo/bin:$PATH to .bashrc manually.

@peterlymo
Copy link

i wonder how can i fix it permanetly? both suggested solution above it fix temporary when i switch user or log out and still cargo not recognised

@kinnison
Copy link
Contributor

kinnison commented Aug 3, 2020

@peterlymo please open a fresh issue if you're having difficulty and rustup hasn't automatically updated your shell config. Please include what version of what OS you're using, which shell, whether you customised it etc. so that we can try and work out why it isn't working for you.

@arafatx
Copy link

arafatx commented Jun 17, 2021

I tried this on the latest Debian 10, Buster, ended up rustc and cargo not getting recognized, even after logging-out-logging-in, restarting, ended up trying @Vallerious comment up here. It worked.

No .bash_profile or whatever as mentioned in the https://doc.rust-lang.org/book/ch01-01-installation.html

This whole thing didn't happen in ubuntu 18.04 though. It was smooth.

also debian mate is getting treated as x86_64-unknown-linux-gnu.

You are right, now in Debian we have a new special error when we try to run the following command like this:

root@sun:~# rustup component add cargo
info: syncing channel updates for 'stable-x86_64-unknown-linux-gnu'
info: latest update on 2021-05-10, rust version 1.52.1 (9bc8c42bb 2021-05-09)
error: Missing manifest in toolchain 'stable-x86_64-unknown-linux-gnu'

My aim is to install suricata but I'm supprised why developers of suricata have to use this buggy script in order to install them. Starting from suricata 6 I've been facing a lot error in rustup... This thing is not so special to have in your Linux. I don't know why devs care so much to include this script. The only solution to install suricata without compiling from source (which has to use rustup for compiling from source) is to use the backport version in Debian but it has limited configs and a bit outdated version.

@AmnonHanuhov
Copy link

On Fedora 34:

  1. Follow the instructions at https://rustup.rs/
  2. bash --login as @bensadiku suggested above

@kenny1323
Copy link

Restart the commands shell, or the operating system

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests