asdf: bug: 0.9.0 installation using homebrew missing lib folders/files
Describe the Bug
When installing the latest 0.9.0 release of asdf, none of the commands work.
/opt/homebrew/Cellar/asdf/0.9.0/libexec/bin/asdf: line 82: /opt/homebrew/opt/asdf/lib/commands/command-help.bash: No such file or directory
It looks like it’s trying to reference files that aren’t there:
$ tree "${ASDF_DIR}/lib"
/opt/homebrew/opt/asdf/lib
├── asdf.fish
└── asdf.sh
I believe there’s supposed to be a commands/
directory in there and some other files based on the repo
Steps to Reproduce
Install the latest asdf (0.9.0) via homebrew brew install asdf
or update to the latest.
Expected Behaviour
I believe the commands should have worked.
Actual Behaviour
No commands work
Environment
That command does not work for me
asdf plugins affected (if relevant)
no plugins works.
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 67
- Comments: 53 (5 by maintainers)
Commits related to this issue
- Workaround for https://github.com/asdf-vm/asdf/issues/1103 — committed to watsonarw/dotfiles by watsonarw 3 years ago
- Workaround for https://github.com/asdf-vm/asdf/issues/1103 — committed to watsonarw/dotfiles by watsonarw 3 years ago
- asdf: Remove placeholders We're past August 31st, 2022! AFAICT, these placeholders never worked quite right, and have caused an *insane* amount of confusion over on the asdf issue tracker. See https... — committed to jfly/homebrew-core by jfly 2 years ago
- asdf: Remove placeholders We're past August 31st, 2022! AFAICT, these placeholders never worked quite right, and have caused an *insane* amount of confusion over on the asdf issue tracker. See https... — committed to Homebrew/homebrew-core by jfly 2 years ago
I confirm that shims broken by Homebrew upgrade can be fixed with:
Thanks, change asdf path and reshim works.
After the upgrade, I fixed it with the following. I hope this can also help others.
Setting up the correct the path
Fixing existing old shims
Fixing all Shims after the upgrade with a small grep and replace
Reload
I encountered this error too but I set
ASDF_DIR
previously toit seems asdf.sh changed in the meantime and the correct
ASDF_DIR
now is:This works well for me:
Which is what the oh-my-zsh plugin does with @sshishov’s fix (https://github.com/ohmyzsh/ohmyzsh/pull/10481).
It does look like all of the missing files exist inside the
libexec
directory. I can confirm that just putting this in fixes it as @jonatan-ivanov suggested:I use the
asdf
oh-my-zsh
plugin, and I had to put that afteroh-my-zsh
is loaded. Perhaps it’s just something that needs to be fixed in theoh-my-zsh
plugin?If you’ve installed with Homebrew, then
export ASDF_DIR='/opt/homebrew/opt/asdf/libexec'
- this worked for me.I think we should close this issue. It’s hard for a layperson to tell that this issue actually is fixed, and if you’re running into trouble, it’s because you’ve incorrectly configured a Homebrew asdf installation.
At the risk of overloading an already overloaded thread, here’s my take on the situation:
AFAICT, the goal is to create shims that never have to change: I don’t think there’s any interest (or even a good mechanism) for regenerating shims whenever you upgrade asdf (and it’s not like
asdf reshim
would even fix the problem, because of https://github.com/asdf-vm/asdf/issues/1115).tl;dr, If you find that your shims mention a specific version of asdf, you’ve probably installed asdf with homebrew and are setting it up incorrectly.
Here’s a broken setup on zsh, but the same basic idea applies to any shell. Note how asdf 0.9.0 shows up in my shims. This works for now, but once a new version of asdf comes out, this will break:
That’s because of this incorrect
source
directive in my~/.zshrc
:To fix this, you need to instead source an
asdf.sh
in alibexec
directory (this is from the “ZSH & Homebrew” instructions on https://asdf-vm.com/guide/getting-started.html#_3-install-asdf):Then start a new terminal, and regenerate your shims (the
rm
is necessary because of https://github.com/asdf-vm/asdf/issues/1115):And tada! My shims no longer mention a specific version of asdf:
IMO, this is very hard to understand, in part because it’s so easy for someone to source the wrong
asdf.sh
script. I think this will all get a little easier to understand when brew follows through on their plan to remove these placeholder scripts in August 2022. It’s also possible there’s a bug in how they’re generating the placeholder script, but I have already spent way too much time reading through issues this morning.<shameless-self-promotion>
If you are like me, and find shims confusing at best and annoying at worst, I encourage you to check out asdf-direnv and try out a shimless life!<shameless-self-promotion>
after fresh install, updating
.zshrc
i see thisI haven’t read this thread in a while as almost all issues with Homebrew are not an issue with any other mechanism of installing asdf and I am not a Homebrew user nor do we maintain the Homebrew Formulae/Cask/whatever.
It has been suggested this issue be closed. Quoting @jfly:
Naturally another issue for a different version number has been raised in https://github.com/asdf-vm/asdf/issues/1231 .
Homebrew auto-updating is really screwing peoples days. Manually updating is an intentional act which should help users control when their systems might break.
I cannot begin to tell you all how much time I have spent on Homebrew related issues on this repo over the years.
I beg you to use the Git installation method and read the instructions carefully, lord only knows how many countless hours I have spent on those.
Thanks to those in this thread who have helped your fellow devs resolve their issues.
I’m thinking my takeaway from this is that it’s better to just install asdf directly instead of installing it via homebrew
@Codex- , instead of manually changing shims, you have to remove the shims folder and then run
reshim
. Regenerated shims will have symlink instead of hardcoded version. Example:In addition to some of the issues seen here, I was experiencing this after updating to
0.9.0
and upgrading to new macos:So had to replace all of the versions in the shims with 0.9.0 to get things working again:
grep -rl /0.8.1_1/ /Users/username/.asdf/shims/ | xargs sed -i "" 's/\/0.8.1_1\//\/0.9.0\//g'
Hopefully, this helps someone
Bump into the same problem. Somehow
unset ASDF_DIR
works for my environment. (macOS 11.6)I am not sure why
find_asdf_cmd
kept the previous ASDF_DIR after upgrade asdf formula to 0.9I just sent in a PR to Homebrew to remove the broken placeholder scripts that are the source of all this confusion: https://github.com/Homebrew/homebrew-core/pull/112102
With these scripts gone, people with incorrect asdf setups will clearly see their
source "$(brew --prefix asdf)/asdf.sh"
fail, and that should be a clue to use the correct source directive (source "$(brew --prefix asdf)/libexec/asdf.sh"
).And to anyone on this thread who just did a
rm ~/.asdf/shims/* && asdf reshim
, found that things were working, and moved on with your lives: your shims will still break the next time you upgrade asdf. Fix the way you source asdf, reshim one last time, and then you should hopefully never have to deal with this again. See my comment above for details on how to check if your shims are broken and how to fix them.Hello guys, I guess we have to add
libexec
to the plugin. I have created the PR: https://github.com/ohmyzsh/ohmyzsh/pull/10481The git repo contains the missing directory https://github.com/asdf-vm/asdf/tree/master/lib/commands but for some reason the homebrew version does not. I cloned the repo and copied in the folder to /usr/local/opt/asdf/lib/commands and now all works again. Guessing it’s missing from the recipe https://github.com/Homebrew/homebrew-core/blob/master/Formula/asdf.rb.
@jfly Thank you so much for your investigation and triaging of this complex issues which spans the interaction between Homebrew and
asdf
. Your explanatory post is a case study for some of the best technical explanations I have seen in a GitHub issues. This saved me so much time and grief. Thank you so much! 👏🏻@AndrewRayCode
Homebrew upgrade removes v0.10.1 under
/opt/homebrew/Cellar/asdf/0.10.1/
then installs v0.10.2/opt/homebrew/Cellar/asdf/0.10.2/
unfortunately the Homebrew formula script doesn’t update the shims scripts generated under~/.asdf/
that use paths/opt/homebrew/Cellar/asdf/0.10.1/
to/opt/homebrew/Cellar/asdf/0.10.2/
The recommended/default way of installation
git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.10.2
Installs everything under~/.asdf
and no paths contain version numbers that could break Updating can be done viaasdf update; asdf plugin update --all
Possible Homebrew fix The simple solution… I don’t know why the Homebrew formula doesn’t just create symbolic links to
~/.asdf
from/opt/homebrew/Cellar/asdf/<version>/
that would maintain asdf’s file structure and paths in configuration and shims allowing homebrew to keep the application underhomebrew/Celler
. It probably breaks one of homebrew’s own standards.Just to pin the gem of this thread again - this one did the trick for me 👍 https://github.com/asdf-vm/asdf/issues/1103#issuecomment-990795248
@jfly Create a script to do brew updates make it then call asdf update and update all asdf plugins from the one command line command.
I’m on an M1 mac and it seems asdf is installed to
/opt/homebrew/opt/asdf
but when I try to source that from my.zshrc
, I still get errors. Does anyone know why or have a fix that will work on my setup?@solidnerd either:
ASDF_DIR
to the location Homebrew installs: or,ASDF_DIR
and just source the configuration scriptI think Homebrew has a custom merging process. The change is actually on the
master
branch: https://github.com/Homebrew/homebrew-core/commit/cd3d21ba3a2c1041b64191b82cee3bffcbe2efdfClosing and re-opening the shell and reinstalling installed versions seems to have fixed this for me.