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

bug: asdf do not warn on binary conflicts after shim install (because a shell rehash is required) #1851

Open
ybart opened this issue Jan 27, 2025 · 0 comments
Labels

Comments

@ybart
Copy link

ybart commented Jan 27, 2025

Describe the Bug

Not sure it is exactly a bug, feel free to requalify as a feature request.

When using zsh (with the default configuration on macOS), installing commands that "conflicts" with the OS installed ones such as ruby which is installed in /usr/bin/ruby or rails in /usr/bin/rails, zsh does not respect $PATH and do not use the shims.

...
-> make -j 4
-> make install
==> Installed ruby-3.4.1 to ~/.asdf/installs/ruby/3.4.1

# `which` is right
% which ruby
=> ~/.asdf/shims/ruby

# but `ruby` is wrong
% ruby --version
=> ruby 2.6.10p210 (2022-04-12 revision 67958) [universal.arm64e-darwin24]

# `type` is also wrong
% type -f ruby
ruby is /usr/bin/ruby

# rehash fixes this
% rehash
% type -f ruby
=> ruby is ~/.asdf/shims/ruby

Steps to Reproduce

  1. Get a fresh macOS install (I used UTM for this)
  2. Use to xcode-select --install install Xcode Tools
  3. Use git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.15.0 to install asdf
  4. Use . "$HOME/.asdf/asdf.sh" to source the asdf script
  5. Use /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" to install Homebrew
  6. Source the Homebrew environment script as instructed.
  7. Use brew install openssl@3 readline libyaml gmp autoconf rust to install Ruby dependences
  8. Use asdf plugin add ruby https://github.com/asdf-vm/asdf-ruby.git to Install ruby plugin
  9. Use sdf install ruby latest to install latest ruby
  10. Use asdf global ruby latest to configure ruby globally
  11. Use ruby --version to check the version

Expected Behaviour

The ruby version in the output should match the one installed by asdf if it is technically possible. If not asdf should detect the issue (conflicting binary in path and zsh shell) after creating a shim and output some warning to the user instructing them to rehash.

Actual Behaviour

It matches the system provided one.

Environment

macOS 15.2 (Fresh install in UTM)


OS:
Darwin rails-sessions.local 24.2.0 Darwin Kernel Version 24.2.0: Fri Dec  6 18:57:59 PST 2024; root:xnu-11215.61.5~2/RELEASE_ARM64_VMAPPLE arm64

SHELL:
zsh 5.9 (arm64-apple-darwin24.0)

BASH VERSION:
3.2.57(1)-release

ASDF VERSION:
v0.15.0-31e8c93

ASDF INTERNAL VARIABLES:
ASDF_DEFAULT_TOOL_VERSIONS_FILENAME=.tool-versions
ASDF_DATA_DIR=/Users/rails-sessions/.asdf
ASDF_DIR=/Users/rails-sessions/.asdf
ASDF_CONFIG_FILE=/Users/rails-sessions/.asdfrc

ASDF INSTALLED PLUGINS:
nodejs                       https://github.com/asdf-vm/asdf-nodejs.git master 93bd217
ruby                         https://github.com/asdf-vm/asdf-ruby.git master a76d00b

asdf plugins affected (if relevant)

No response

@ybart ybart added the bug label Jan 27, 2025
@ybart ybart changed the title bug: bug: asdf does not warn a binary conflicts with newly installed shim and the shell cache has to be refreshed Jan 27, 2025
@ybart ybart changed the title bug: asdf does not warn a binary conflicts with newly installed shim and the shell cache has to be refreshed bug: asdf fails to warn on binary conflicts after shim Install (because a shell rehash is required) Jan 27, 2025
@ybart ybart changed the title bug: asdf fails to warn on binary conflicts after shim Install (because a shell rehash is required) bug: asdf fails to warn on binary conflicts after shim install (because a shell rehash is required) Jan 27, 2025
@ybart ybart changed the title bug: asdf fails to warn on binary conflicts after shim install (because a shell rehash is required) bug: asdf do not warn on binary conflicts after shim install (because a shell rehash is required) Jan 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant