Rustup

Hello,

A while back, I installed Rust using freshports lang/rust, which to my knowledge is the preferred method for installing and keeping a port up to date. However, I am now trying to install rustup but I get the following error:

Code:
info: downloading installer
warning: it looks like you have an existing installation of Rust at:
warning: /usr/local/bin
warning: rustup should not be installed alongside Rust. Please uninstall your existing Rust first.
warning: Otherwise you may have confusion unless you are careful with your PATH
warning: If you are sure that you want both rustup and your already installed Rust
warning: then please reply `y' or `yes' or set RUSTUP_INIT_SKIP_PATH_CHECK to yes
warning: or pass `-y' to ignore all ignorable checks.
error: cannot install while Rust is installed

The reason I want to install rustup is to use other toolchains such as +nightly with cargo. See the toolchain section.

In order to install rustup, must I bypass the freshports and uninstall rust?

Cheers
 
Last edited by a moderator:
As it says, it is perfectly safe as long as you consciously adjust $PATH to point to the rust version you want at any given moment.

And if you run into trouble later you can always uninstall the port at that time.
 
FWIW, I haven been using rustup-installed rust on a few FreeBSD machines for a while now (some months). It doesn't conflict with ports / package installed rust as long as you follow the advice in the installer. The installer will (if you let it) install this script
Code:
tingo@kg-core1:~ $ more ~/.cargo/env
#!/bin/sh
# rustup shell setup
# affix colons on either side of $PATH to simplify matching
case ":${PATH}:" in
    *:"$HOME/.cargo/bin":*)
        ;;
    *)
        # Prepending path in case a system-installed rustc needs to be overridden
        export PATH="$HOME/.cargo/bin:$PATH"
        ;;
esac
which is sourced from $HOME/.profile of your user.
 
The downside to installing the package manually is that tools like portmaster can't be used to check and install updates with other ports.
 
The rust from ports?
No, you don't have to uninstall it.
Simply set environment variables and PATH for you user (the rustup installer will do that for you, if you answer yes when it asks) so it will use the rust installed by rustup.
 
Back
Top