bug: installing via sudo-less homebrew may not work (outside of /usr/local/bin)
Describe the Bug
dotfiles ➤ brew install asdf
Running `brew update --auto-update`...
==> Auto-updated Homebrew!
Updated 2 taps (homebrew/core and homebrew/cask).
==> New Casks
devsquadron
You have 58 outdated formulae and 2 outdated casks installed.
You can upgrade them with brew upgrade
or list them with brew outdated.
==> Fetching dependencies for asdf: automake, gmp, coreutils, openssl@3 and unixodbc
==> Fetching automake
==> Downloading https://ghcr.io/v2/homebrew/core/automake/manifests/1.16.5
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/automake/blobs/sha256:f68481d06be7fa3f0a0881edb825a336e7f6548191c762d68bd817183b238f5a
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sha256:f68481d06be7fa3f0a0881edb825a336e7f6548191c762d68bd817183b2
######################################################################## 100.0%
==> Fetching gmp
==> Downloading https://ghcr.io/v2/homebrew/core/gmp/manifests/6.2.1_1
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/gmp/blobs/sha256:2436cd120e5678d67c24020a50cbbf7c0220e7ecaac63981335872b9d666bcad
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sha256:2436cd120e5678d67c24020a50cbbf7c0220e7ecaac63981335872b9d66
######################################################################## 100.0%
==> Fetching coreutils
==> Downloading https://ghcr.io/v2/homebrew/core/coreutils/manifests/9.1
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/coreutils/blobs/sha256:ae9dc313da2a3971c8e633d9f3262fd1bd431c303207b3346924aed60bb0965d
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sha256:ae9dc313da2a3971c8e633d9f3262fd1bd431c303207b3346924aed60bb
######################################################################## 100.0%
==> Fetching openssl@3
==> Downloading https://ghcr.io/v2/homebrew/core/openssl/3/manifests/3.0.7
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/openssl/3/blobs/sha256:5b3d605f5c1fcadfea094c5670091e4bec2b2de7c121874be166bc737ef64ccf
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sha256:5b3d605f5c1fcadfea094c5670091e4bec2b2de7c121874be166bc737ef
######################################################################## 100.0%
==> Fetching unixodbc
==> Downloading https://ghcr.io/v2/homebrew/core/unixodbc/manifests/2.3.11
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/unixodbc/blobs/sha256:4c0380e01085731950092d3fdbcb24865abcb7745cbb318759e21d77e14c2fa1
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sha256:4c0380e01085731950092d3fdbcb24865abcb7745cbb318759e21d77e14
######################################################################## 100.0%
==> Fetching asdf
==> Downloading https://ghcr.io/v2/homebrew/core/asdf/manifests/0.11.0
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/asdf/blobs/sha256:8f0826eeb40dd4dde2399e299ef1231d1207da315143e5e8bccef5e2bb0ce033
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sha256:8f0826eeb40dd4dde2399e299ef1231d1207da315143e5e8bccef5e2bb0
######################################################################## 100.0%
==> Installing dependencies for asdf: automake, gmp, coreutils, openssl@3 and unixodbc
==> Installing asdf dependency: automake
==> Pouring automake--1.16.5.arm64_ventura.bottle.tar.gz
🍺 /opt/homebrew/Cellar/automake/1.16.5: 131 files, 3.5MB
==> Installing asdf dependency: gmp
==> Pouring gmp--6.2.1_1.arm64_ventura.bottle.tar.gz
🍺 /opt/homebrew/Cellar/gmp/6.2.1_1: 21 files, 3.2MB
==> Installing asdf dependency: coreutils
==> Pouring coreutils--9.1.arm64_ventura.bottle.tar.gz
🍺 /opt/homebrew/Cellar/coreutils/9.1: 476 files, 13.2MB
==> Installing asdf dependency: openssl@3
==> Pouring [email protected]_ventura.bottle.tar.gz
🍺 /opt/homebrew/Cellar/openssl@3/3.0.7: 6,454 files, 28.0MB
==> Installing asdf dependency: unixodbc
==> Pouring unixodbc--2.3.11.arm64_ventura.bottle.tar.gz
🍺 /opt/homebrew/Cellar/unixodbc/2.3.11: 48 files, 2.3MB
==> Installing asdf
==> Pouring asdf--0.11.0.all.bottle.tar.gz
==> Caveats
To use asdf, add the following line to your ~/.zshrc:
. /opt/homebrew/opt/asdf/libexec/asdf.sh
Restart your terminal for the settings to take effect.
zsh completions have been installed to:
/opt/homebrew/share/zsh/site-functions
==> Summary
🍺 /opt/homebrew/Cellar/asdf/0.11.0: 167 files, 688.8KB
==> Running `brew cleanup asdf`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
==> Caveats
==> asdf
To use asdf, add the following line to your ~/.zshrc:
. /opt/homebrew/opt/asdf/libexec/asdf.sh
Restart your terminal for the settings to take effect.
zsh completions have been installed to:
/opt/homebrew/share/zsh/site-functions
dotfiles ➤ asdf git:master
version: v0.11.0
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 on
default branch or a particular git-ref
asdf plugin update --all Update all plugins to latest commit on
default branch
MANAGE PACKAGES
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 global <name> <version> Set the package global version
asdf global <name> latest[:<version>] Set the package global version to the
latest provided version
asdf help <name> [<version>] Output documentation for plugin and tool
asdf install Install all the package versions listed
in the .tool-versions file
asdf install <name> Install one tool at the version
specified in the .tool-versions file
asdf install <name> <version> Install a specific version of a package
asdf install <name> latest[:<version>] Install the latest stable version of a
package, or with optional version,
install the latest stable version that
begins with the given string
asdf latest <name> [<version>] Show latest stable version of a package
asdf latest --all Show latest stable version of all the
packages and if they are installed
asdf list <name> [version] List installed versions of a package and
optionally filter the versions
asdf list all <name> [<version>] List all versions of a package and
optionally filter the returned versions
asdf local <name> <version> Set the package local version
asdf local <name> latest[:<version>] Set the package local version to the
latest provided version
asdf shell <name> <version> Set the package version to
`ASDF_${LANG}_VERSION` in the current shell
asdf uninstall <name> <version> Remove a specific version of a package
asdf where <name> [<version>] Display install path for an installed
or current version
asdf which <command> Display the path to an executable
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 info Print OS, Shell and ASDF debug information.
asdf reshim <name> <version> Recreate shims for version of a package
asdf shim-versions <command> List the plugins and versions that
provide a command
asdf update Update asdf to the latest stable release
asdf update --head Update asdf to the latest on the master branch
RESOURCES
GitHub: https://github.com/asdf-vm/asdf
Docs: https://asdf-vm.com
PLUGIN nodejs
asdf nodejs nodebuild
asdf nodejs update nodebuild
"Late but latest"
-- Rajinikanth
dotfiles ➤ asdf plugin add deno
initializing plugin repository...Cloning into '/Users/devinrhode2/.asdf/repository'...
remote: Enumerating objects: 4598, done.
remote: Counting objects: 100% (422/422), done.
remote: Compressing objects: 100% (209/209), done.
remote: Total 4598 (delta 254), reused 374 (delta 210), pack-reused 4176
Receiving objects: 100% (4598/4598), 1.01 MiB | 3.33 MiB/s, done.
Resolving deltas: 100% (2435/2435), done.
dotfiles ➤ asdf plugin add nodejs https://github.com/asdf-vm/asdf-nodejs.git
Plugin named nodejs already added
dotfiles ➤ asdf install nodejs latest
Trying to update node-build... ok
Downloading node-v19.3.0-darwin-arm64.tar.gz...
-> https://nodejs.org/dist/v19.3.0/node-v19.3.0-darwin-arm64.tar.gz
Installing node-v19.3.0-darwin-arm64...
Installed node-v19.3.0-darwin-arm64 to /Users/devinrhode2/.asdf/installs/nodejs/19.3.0
dotfiles ➤ asdf global nodejs latest
tail: /Users/devinrhode2/.tool-versions: No such file or directory
dotfiles ➤ node
zsh: command not found: node
dotfiles ➤ node
zsh: command not found: node
dotfiles ➤ . /opt/homebrew/opt/asdf/libexec/asdf.sh
dotfiles ➤ node
/Users/devinrhode2/.asdf/shims/node: line 4: /opt/homebrew/Cellar/asdf/0.10.2/libexec/bin/asdf: No such file or directory
/Users/devinrhode2/.asdf/shims/node: line 4: exec: /opt/homebrew/Cellar/asdf/0.10.2/libexec/bin/asdf: cannot execute: No such file or directory
dotfiles ➤ brew brew --prefix asdf
dotfiles ➤ brew --prefix asdf
/opt/homebrew/opt/asdf
Steps to Reproduce
Install homebrew without sudo (see my homebrew prefix at bottom of logs above)
Install asdf via homebrew
Install node via asdf
Run node
node is not defined
Expected Behaviour
node should be defined. Some earlier process probably should have failed.
Which step should have failed will depend on where the actual problem exists.
I suppose each step should do some basic checks to determine if things will be working correctly?
Or there could be a general-purpose asdf doctor command, similar to homebrew.
If asdf installs but can't hook into shell executables..
Maybe after adding the nodejs plugin, asdf checks if it can add a node shim successfully. If it can't, it uninstalls the nodejs plugin. Or, it does this check before installing the nodejs plugin.
If you tried to install asdf on a windows 95 machine, it should probably fail right away, saying that your platform is not supported.
Actual Behaviour
node is not defined
Environment
OS:
Darwin MacBook-Air 22.1.0 Darwin Kernel Version 22.1.0: Sun Oct 9 20:14:30 PDT 2022; root:xnu-8792.41.9~2/RELEASE_ARM64_T8103 arm64
SHELL:
zsh 5.8.1 (x86_64-apple-darwin22.0)
ASDF VERSION:
v0.11.0-6a4f51a
ASDF ENVIRONMENT VARIABLES:
ASDF_DIR=/Users/devinrhode2/.asdf
ASDF INSTALLED PLUGINS:
deno [email protected]:asdf-community/asdf-deno.git master 87442fe
nodejs [email protected]:asdf-vm/asdf-nodejs.git master c9e5df4
asdf plugins affected (if relevant)
nodejs?
Our docs do warn that depending on your setup you may need sudo. I don't believe we should add a new command for this type of situation, asdf doctor. Supporting all permutations of people's setups is difficult, though we can guard against bad states.
When in this state, what does running asdf reshim do? Does it error? It may be that the error is being masked when it is called during install:
https://github.com/asdf-vm/asdf/blob/5af76257693d1f560b9c27c9cdcc6f5a5a33c4d5/lib/functions/installs.bash#L232
Idk what reshim would do
I'm using the git install method now
On Tue, Dec 20, 2022, 8:35 PM James Hegedus @.***> wrote:
Our docs do warn that depending on your setup you may need sudo. I don't believe we should add a new command for this type of situation, asdf doctor.
When in this state, what does running asdf reshim do? Does it error? It may be that the error is being masked when it is called during install:
https://github.com/asdf-vm/asdf/blob/5af76257693d1f560b9c27c9cdcc6f5a5a33c4d5/lib/functions/installs.bash#L232
— Reply to this email directly, view it on GitHub https://github.com/asdf-vm/asdf/issues/1387#issuecomment-1360650237, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAEDZKGL4PG7CIRFUQDANXLWOJNERANCNFSM6AAAAAATE6FFX4 . You are receiving this because you authored the thread.Message ID: @.***>
Reshim would attempt to recreate the shims, so if your speculation is correct that the shims couldn't have be created then perhaps reshim would surface the issue and we would A) confirm the source of the problem and B) be let us to dig into how the problem is being masked. As it is, we have little information.
The codebase currently does perform checks and even has a rollback mechanism in the install code paths.
The core team do not use the community created Homebrew package which causes a lot of issues for users. So unless you have the time to create a failing test case in our test suite, we will have a hard time emulating the specific scenario and remediating any errors within the codebase.
Does asdf currently have a mechanism for informing users of new releases when they are running commands?
If it does, mentioning this in docs would be a good idea, after "We highly recommend using the official git method."
It might also help to include some rationale.
- Nobody on core team uses homebrew
- Using homebrew introduces an additional layer of complexity where things can fail, particularly for a tool like asdf, because it also makes a lot of changes to system binaries.
Does asdf currently have a mechanism for informing users of new releases when they are running commands?
It does not, though this is planned.
Does asdf currently have a mechanism for informing users of new releases when they are running commands?
If it does, mentioning this in docs would be a good idea, after "We highly recommend using the official git method."
It might also help to include some rationale.
- Nobody on core team uses homebrew
- Using homebrew introduces an additional layer of complexity where things can fail, particularly for a tool like asdf, because it also makes a lot of changes to system binaries.
Thanks very much for the explanation @devinrhode2 - homebrew is seemingly an easier way of installing (as it manages the dependencies) and it doesn't look like anything will break if you just use homebrew (why would they add that installation method to the official readme if it doesn't work?!) - so this extra context is useful. If you have time, it might be nice to add that explanation to the docs. Cheers regardless!