-
Notifications
You must be signed in to change notification settings - Fork 1k
Description
Verification
- I searched for recent similar issues at https://github.com/rust-lang/rustup/issues?q=is%3Aissue and found no duplicates.
- I am on the latest version of Rustup according to https://github.com/rust-lang/rustup/tags and am still able to reproduce my issue.
Problem
When uninstalling toolchains en masse using rustup toolchain list | rg ^nightly-20 | xargs rustup toolchain uninstall (à la #2530), I keep getting errors about rustup not being able to remove directories due to them not being empty. This only happens after at least one has been successfully removed, sometimes several. E.g.:
❯ rustup toolchain list | rg ^nightly-20 | xargs rustup toolchain uninstall
info: uninstalling toolchain 'nightly-2025-05-12-aarch64-apple-darwin'
info: toolchain 'nightly-2025-05-12-aarch64-apple-darwin' uninstalled
info: uninstalling toolchain 'nightly-2025-05-21-aarch64-apple-darwin'
info: toolchain 'nightly-2025-05-21-aarch64-apple-darwin' uninstalled
info: uninstalling toolchain 'nightly-2025-06-24-aarch64-apple-darwin'
info: toolchain 'nightly-2025-06-24-aarch64-apple-darwin' uninstalled
info: uninstalling toolchain 'nightly-2025-07-04-aarch64-apple-darwin'
error: could not remove 'install' directory: '/Users/noahlev/.rustup/toolchains/nightly-2025-07-04-aarch64-apple-darwin': Directory not empty (os error 66)Note that if I run the command again, then it successfully finishes uninstalling that toolchain and usually a few more, before the error then happens again with a different toolchain.
Steps
- Install several nightly toolchains.
- Run
rustup toolchain list | rg ^nightly-20 | xargs rustup toolchain uninstall.
Possible Solution(s)
It seems like some kind of race condition when removing files, but it's strange because xargs allows each command to complete before running the next. I wonder if this could be an issue with macOS metadata files like .DS_Store, but I'm not actually sure -- just a guess.
Notes
No response
Rustup version
❯ rustup --version
rustup 1.28.2 (e4f3ad6f8 2025-04-28)
info: This is the version for the rustup toolchain manager, not the rustc compiler.
info: The currently active `rustc` version is `rustc 1.90.0 (1159e78c4 2025-09-14)`Installed toolchains
Not really relevant because they're in flux as I uninstall, but here it is anyway:
❯ rustup show
Default host: aarch64-apple-darwin
rustup home: /Users/noahlev/.rustup
installed toolchains
--------------------
stable-aarch64-apple-darwin (active, default)
beta-aarch64-apple-darwin
nightly-aarch64-apple-darwin
nightly-2025-07-04-aarch64-apple-darwin
1.50.0-aarch64-apple-darwin
1.65.0-aarch64-apple-darwin
1.79.0-aarch64-apple-darwin
bisector-ci-a77cc64af491a31db224109a76b9b81cd26cd07c-aarch64-apple-darwin
bisector-ci-cfa4ac66c194046f631ce076c75516ecfdeb77ee-aarch64-apple-darwin
bisector-ci-f1ce0e6a00593493a12e0e3662119786c761f375-aarch64-apple-darwin
bisector-nightly-2021-01-06-aarch64-apple-darwin
bisector-nightly-2022-01-06-aarch64-apple-darwin
bisector-nightly-2022-01-07-aarch64-apple-darwin
miri
r1stage0
r1stage1
r1stage2
r2stage0
r2stage1
r2stage2
active toolchain
----------------
name: stable-aarch64-apple-darwin
active because: it's the default toolchain
installed targets:
aarch64-apple-darwin
wasm32-unknown-unknown
x86_64-apple-darwin
x86_64-unknown-linux-gnuOS version
macOS Tahoe - Apple Silicon