brew install asdfasdf or asdf helpShould list help text for asdf
cat: /usr/local/VERSION: No such file or directory
version:
cat: /usr/local/help.txt: No such file or directory
"Late but latest"
-- Rajinikanth
OS: macOS 10.14.6
asdf version: 0.75
I'm not a Homebrew user, it'd be awesome if you can find what's the problem, looks like the asdf_dir function thinks it's somehow at /usr/local/lib/utils.sh which would be weird.
@vic The issue has probably to do with how Homebrew links files. So the brew installation links everything to /usr/local, like this:
$ brew link asdf --dry-run
Would link:
/usr/local/etc/bash_completion.d/asdf.bash
/usr/local/bin/asdf
/usr/local/share/fish/vendor_completions.d/asdf.fish
/usr/local/lib/asdf.fish
/usr/local/lib/asdf.sh
/usr/local/lib/commands
/usr/local/lib/utils.sh
When running /usr/local/lib/commands/command-help it tries to read help.txt from asdf_dir() which does not resolve to the brew install path but the symlink path.
One option would be to make an conditional to return $(brew --prefix asdf) from asdf_dir() if asdf was installed from Homebrew.
Hm, that's weird, so your /usr/local/lib/utils.sh is a symlink to the real $ASDF_DIR/lib/utils.sh ? I wouldn't expect brew to do that, what if another package had their own lib/utils.sh file, that would cause problems. And.. even when you have lib/utils.sh symlinked, you don't have a /usr/local/VERSION symlink, right?
On our side, I believe we have to make bin/asdf determine if it's own file is a link and somehow resolve to the real ASDF dir, probably using something like realpath (from coreutils but that would cause asdf to depend on coreutils being available) or readlink. If I recall correctly both of realpathand readlink were being checked somewhere inside test/ as forbidden commands, and there was also a function of our own to resolve links.
In the meantime you could use the bin/asdf from the real location where asdf was installed by homebrew.
@jmegs, you were using asdf homebrew with --HEAD right?, are you also having this issue?
I'm testing the asdf setup on my other machine so can't confirm until later tonight EST, but as far as I could tell I was seeing help text loaded correctly with the bare asdf command. Don't recall if I ever ran asdf help directly. Will confirm tonight.
EDIT: for more context, I'm experimenting with switching my dotfiles over to use asdf vs. nvm and rbenv together. So I'm very in favor of having homebrew installs working well so I can brew "asdf", args: ['HEAD'] in my Brewfile along with all my other software rather than having to script just that one thing using git directly.
@vic That weirdness comes from the fact, that the Homebrew formula links all directories in the asdf repo and this line https://github.com/asdf-vm/asdf/blob/master/bin/asdf#L4
@deiga looks like that's the line we have to change. Are you willing to sending a PR and test it works with brew symlinks, please?
@vic Yeah, I can try and find some time to work on this.
@deiga Tell me if you need some help with that.
In the meantime you could use the
bin/asdffrom the real location where asdf was installed by homebrew.
That helped me. Thanks!
% which asdf
/usr/local/bin/asdf
% realpath /usr/local/bin/asdf
/usr/local/Cellar/asdf/0.7.6/bin/asdf
% /usr/local/Cellar/asdf/0.7.6/bin/asdf
version: v0.7.6
etc..
It seems to work with the latest version of asdf (v0.7.7 at the time of writing):
> which asdf
/usr/local/opt/asdf/bin/asdf
> realpath $(which asdf)
/usr/local/Cellar/asdf/0.7.7/bin/asdf
> asdf help
version: v0.7.7
MANAGE PLUGINS
asdf plugin add <name> [<git-url>] Add a plugin from the plugin repo OR, add a Git repo
as a plugin by specifying the name and repo url
asdf plugin list [--urls] [--refs] List installed plugins. Optionally show git urls and git-ref.
asdf plugin list all List plugins registered on asdf-plugins repository with URLs
asdf plugin remove <name> Remove plugin and package versions
asdf plugin update <name> [<git-ref>] Update a plugin to latest commit or a particular git-ref.
asdf plugin update --all Update all plugins
MANAGE PACKAGES
asdf install [<name> <version>] Install a specific version of a package or,
with no arguments, install all the package
versions listed in the .tool-versions file
asdf uninstall <name> <version> Remove a specific version of a package
asdf current Display current version set or being used for all packages
asdf current <name> Display current version set or being used for package
asdf where <name> [<version>] Display install path for an installed or current version
asdf which <command> Display the path to an executable
asdf shell <name> <version> Set the package version in the current shell
asdf local <name> <version> Set the package local version
asdf global <name> <version> Set the package global version
asdf list <name> List installed versions of a package
asdf list all <name> List all versions of a package
UTILS
asdf exec <command> [args..] Executes the command shim for current version
asdf env <command> [util] Runs util (default: `env`) inside the environment used for command shim execution.
asdf reshim <name> <version> Recreate shims for version of a package
asdf shim-versions <command> List on which plugins and versions is command available
asdf update Update asdf to the latest stable release
asdf update --head Update asdf to the latest on the master branch
"Late but latest"
-- Rajinikanth
On v0.7.8, this issue still appears
re-pro steps are here
brew install asdf
# or
brew install asdf --HEAD
asdf
@januswel Thanks for reporting.
Your reproduction doesn't follow all of the asdf setup instructions. Namely, you need to add asdf to your shell as well.
# install
brew install asdf
# add to shell <-- commonly missed setup step
. $(brew --prefix asdf)/asdf.sh
# restart your shell <-- commonly missed setup step
# run asdf command
asdf
Can you confirm this occurs after all the setup steps are complete?
Thank you @jthegedus
It works after adding . $(brew --prefix asdf)/asdf.sh
Glad that helped. I am going to be updating the docs soon to better communicate that it is a multi-step process as most homebrew users hit this issue.
@jthegedus
I am going to be updating the docs soon to better communicate that it is a multi-step process as most homebrew users hit this issue.
It's very nice!!
I have added some changes to show install instructions for the Homebrew formula
https://github.com/Homebrew/homebrew-core/pull/54315
Feel free to close and create another PR to improve in your way 馃檱
you don't need to restart the shell (for those of you have like 20 open)
just include this line
. $(brew --prefix asdf)/asdf.sh
into your .*rc file (I'm using zshrc on this box at the time)
_ie_:
echo ". $(brew --prefix asdf)/asdf.sh" >> $HOME/.zshrc # (or .bashrc depending on which shell you are using)
and then do this:
source ~/.zshrc
~ % asdf help
version: v0.7.8
MANAGE PLUGINS
asdf plugin add <name> [<git-url>] Add a plugin from the plugin repo OR, add a Git repo
as a plugin by specifying the name and repo url
asdf plugin list [--urls] [--refs] List installed plugins. Optionally show git urls and git-ref.
asdf plugin list all List plugins registered on asdf-plugins repository with URLs
asdf plugin remove <name> Remove plugin and package versions
asdf plugin update <name> [<git-ref>] Update a plugin to latest commit or a particular git-ref.
asdf plugin update --all Update all plugins
MANAGE PACKAGES
asdf install [<name> <version>] Install a specific version of a package or,
with no arguments, install all the package
versions listed in the .tool-versions file
asdf uninstall <name> <version> Remove a specific version of a package
asdf current Display current version set or being used for all packages
asdf current <name> Display current version set or being used for package
asdf where <name> [<version>] Display install path for an installed or current version
asdf which <command> Display the path to an executable
asdf shell <name> <version> Set the package version in the current shell
asdf local <name> <version> Set the package local version
asdf global <name> <version> Set the package global version
asdf list <name> List installed versions of a package
asdf list all <name> List all versions of a package
UTILS
asdf exec <command> [args..] Executes the command shim for current version
asdf env <command> [util] Runs util (default: `env`) inside the environment used for command shim execution.
asdf reshim <name> <version> Recreate shims for version of a package
asdf shim-versions <command> List on which plugins and versions is command available
asdf update Update asdf to the latest stable release
asdf update --head Update asdf to the latest on the master branch
"Late but latest"
-- Rajinikanth
Most helpful comment
@jthegedus
It's very nice!!
I have added some changes to show install instructions for the Homebrew formula
https://github.com/Homebrew/homebrew-core/pull/54315
Feel free to close and create another PR to improve in your way 馃檱