Skip to content

Upgrading to 0.16.0 with Homebrew #2069

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

Open
neil1023 opened this issue Apr 21, 2025 · 4 comments
Open

Upgrading to 0.16.0 with Homebrew #2069

neil1023 opened this issue Apr 21, 2025 · 4 comments

Comments

@neil1023
Copy link

How can we improve the documentation?

So I installed asdf locally using homebrew. Now I would like to upgrade to the latest asdf but I keep seeing this message:

----------

NOTICE:

You have tried to upgrade to asdf 0.16.0 or newer. Versions 0.16.0 is a
complete rewrite of asdf in Go. This text is being printed by the older
Bash implementation. If you are seeing this you have not migrated to
asdf 0.16.0. Please follow the instructions on the upgrade guide to
migrate to the new version.

Aside from this notice, this older Bash implementation works as it did
in asdf version 0.15.0 and older.

Migration guide: https://asdf-vm.com/guide/upgrading-to-v0-16
asdf website: https://asdf-vm.com
Source code: https://github.com/asdf-vm/asdf

When I view the migration guide, I see that it instructs me to download the latest release from the Github releases page. But it's unclear to me whether I should do this even if I downloaded asdf via homebrew initially. Can someone clarify whether I should follow this step in the migration guide or whether I should ugrade asdf via brew upgrade asdf? Also, can the documentation be updated to take note of which steps to take depending on how asdf was initially installed (i.e. via package manager such as homebrew)? Thanks!

@ryan-robeson
Copy link

brew info asdf shows

==> asdf: stable 0.16.7 (bottled), HEAD

And there's this paragraph in the migration guide:

If your operating system's package manager already offers asdf 0.16.0 that is probably the best method for installing it. Upgrading asdf is now only possible via OS package managers and manual installation. There is no self-upgrade feature.

So, I think you're good to upgrade with brew and then follow the rest of the guide.

@neil1023
Copy link
Author

neil1023 commented Apr 22, 2025

Thanks! I was also curious about the steps after performing a brew upgrade asdf.
I performed a brew upgrade asdf and then following the steps in the migration guide.

The steps didn't work as expected for me but after understanding it all more, I set the following variables in my ~/.zshrc:

export ASDF_DATA_DIR="$HOME/.asdf"
export PATH="/opt/homebrew/Cellar/asdf/0.16.7/bin:$PATH"
export ASDF_DIR="/opt/homebrew/Cellar/asdf/0.16.7"
export PATH="$ASDF_DATA_DIR/shims:$PATH"

This successfully updated my asdf from 0.15.x to 0.16.7 and maintained my data ✅

The only issue is that when I upgrade asdf in the future, I will need to update these variables. If anyone finds a better approach, let me know - thanks!

Note: I have an M1 Macbook Pro so my homebrew's directories are configured for Apple silicon

@ryan-robeson
Copy link

ryan-robeson commented Apr 22, 2025

No problem! I'm just now setting up asdf myself, so I may be off base, but I think as long as you have /opt/homebrew/bin in your PATH before /usr/bin that your first PATH export isn't necessary. Also, looking at https://asdf-vm.com/guide/getting-started.html I don't think setting ASDF_DIR is necessary. Maybe it used to be?

So I think you just need something like:

export PATH=/opt/homebrew/bin:$PATH # if you don't have this already
# Or more generically
# export PATH=$(brew --prefix)/bin:$PATH
export ASDF_DATA_DIR="$HOME/.asdf" # technically this line isn't needed if using the default of $HOME/.asdf
export PATH="${ASDF_DATA_DIR:-$HOME/.asdf}/shims:$PATH"

@neil1023
Copy link
Author

Ah thanks. Adding /opt/homebrew/bin to my PATH. And thanks, just removed ASDF_DIR.
Now I have this:

export PATH="/opt/homebrew/bin:$PATH"
export ASDF_DATA_DIR="$HOME/.asdf"
export PATH="${ASDF_DATA_DIR:-$HOME/.asdf}/shims:$PATH"

When I open a new terminal session, I see this works as expected! ✅
But yeah, might be helpful to update the migration guide with more details on what to do for this scenario

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants