rust-lang / rustup

The Rust toolchain installer
https://rust-lang.github.io/rustup/
Apache License 2.0
6.03k stars 877 forks source link

Homebrew conflicts with rustup (detect and warn about it?) #1236

Open kornelski opened 6 years ago

kornelski commented 6 years ago

On macOS if you install anything with Homebrew that has Rust as a dependency (including any program that has to be built from Rust source), Homebrew will install Rust system-wide and it will take precedence over rustup.

I've ran into this — it looked like if rustup default command didn't work properly. I took me a while to realize that binaries in /usr/local/bin are not from rustup.

Homebrew dislikes using any binaries and update mechanisms they don't control (including rustup), so I think it's up to Rustup to improve this situation.

As a solution I suggest emitting a warning when rustup default command is used if the PATH contains both Rustup rustc and non-Rustup rustc, and non-Rustup rustc is first. That will catch this error, but won't get in the way of using Rustup without the PATH modified for Rustup.

skull-squadron commented 6 years ago

A quick fix is brew uninstall rust or brew unlink rust. rustup and rustup-init formulas are mutually-exclusive, and should mutually conflicts or whatever with each other. The latter seems to be a brew package of rustup. Files issues about Homebrew there, because rustup properly detects an existing rust and exits.

kornelski commented 6 years ago

To clarify, the situation I'm talking about has nothing to do with conflicts of Homebrew's packages.

Consider this scenario:

  1. Install rustup and use rustc from rustup (there's no Homebrew rustc, no conflict)
  2. Install rustc from Homebrew (Homebrew doesn't care rustup is there, and does not report any problem)
  3. Try to use rustup default to change rustc (doesn't appear to work)

I would like 3. to warn that it's been affected by another rustc in PATH, and it no longer works as usual.

While I mention Homebrew specifically, the problem is not unique to Homebrew. Identical problem can happen when you install another copy of rustc from any package manager.

workingjubilee commented 3 years ago

@rustbot label: +O-macos