1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

miseでrustをinstallするとrust-analyzer in rust error Unknown binary 'rust-analyzer' in official toolchainとなる

1
Last updated at Posted at 2025-11-27

解決した対応

~/.cargo/bin/rust-analyzer に貼られていたシンボリックリンクを削除する

rm ~/.cargo/bin/rust-analyzer

再現手順

miseでrustをinstallする

mise use rust@1.91.1

ついでに、rust-analyzerも入れておく。

mise use rust-analyzer@2025-11-17

rust-analyzerを叩いてみる

rust-analyzer --version
error: Unknown binary 'rust-analyzer' in official toolchain '1.91.1-x86_64-apple-darwin'.

調査

とりあえずwhichを叩く。

which rust-analyzer
/Users/ohnuma/.local/share/mise/shims/rust-analyzer

miseを向いてそう。

mise whichで実際はどこを叩いているかを確認。
実際は~/.cargo/bin/rust-analyzerを叩いていた。

mise which rust-analyzer
/Users/ohnuma/.cargo/bin/rust-analyzer
type -a rust-analyzer
rust-analyzer is /Users/ohnuma/.local/share/mise/shims/rust-analyzer
rust-analyzer is /Users/ohnuma/.cargo/bin/rust-analyzer

~/.cargo/bin/rust-analyzerを見てみると、rustupにシンボリックリンクが貼られていた。

ls -l ~/.cargo/bin/rust-analyzer
/Users/ohnuma/.cargo/bin/rust-analyzer@ -> rustup

調べてみるとこんなissueを発見。rustup側の問題らしい。

今回はmiseでinstallしたrust-analyzerを使いたいので、rustup向いていてはどっちみち困ります。
そこで思い切ってこのシンボリックリンクを消してみました。

rm ~/.cargo/bin/rust-analyzer

するといい感じに叩けていそうです。

rust-analyzer --version
rust-analyzer 0.3.2683-standalone (2efc800780 2025-11-11)

mise whichもmiseでinstallしたものにパスが通っていそう。

which rust-analyzer
/Users/ohnuma/.local/share/mise/shims/rust-analyzer

mise which rust-analyzer
/Users/ohnuma/.local/share/mise/installs/rust-analyzer/2025-11-17/rust-analyzer

type -a rust-analyzer
rust-analyzer is /Users/ohnuma/.local/share/mise/shims/rust-analyzer

lspでも無事に拾えているので、これで解決しました。

終わりに

mise use rust するたびにこれが発生するのでとんでもなくめんどくさいです。
miseをactivateではなくshimsで使っているから発生しているのかもしれないですが検証していないです。
rustをinstallするときだけシンボリックリンク削除するmiseのタスクランナー書こうかな。。

何か他によりよい打開策見つかればぜひ教えてください。

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?