Created
March 21, 2025 02:09
-
-
Save hongsw/39552ac7807bdac2f025f3b84951a4f4 to your computer and use it in GitHub Desktop.
Purpose of the Script This script automates the configuration changes required when upgrading to ASDF version 0.16.0 from earlier versions. The purpose is to: Safely back up the user's existing .zshrc configuration file Remove any outdated ASDF-related configuration lines Add the new required environment variables and PATH modifications for ASDF…
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Create backup filename with current date and time | |
BACKUP_FILE=~/.zshrc.backup.$(date +%Y%m%d%H%M%S) | |
# Backup original file | |
cp ~/.zshrc "$BACKUP_FILE" | |
echo "Existing .zshrc file has been backed up to $BACKUP_FILE" | |
# Remove existing ASDF-related settings and create new file | |
grep -v "asdf\|ASDF_DATA_DIR" ~/.zshrc > ~/.zshrc.new | |
# Add new ASDF settings | |
echo 'export ASDF_DATA_DIR="$HOME/.asdf" && export PATH="$ASDF_DATA_DIR/shims:$HOME/bin:$PATH"' >> ~/.zshrc.new | |
# Replace original file | |
mv ~/.zshrc.new ~/.zshrc | |
# Output changes | |
echo -e "\nChanges made:" | |
diff "$BACKUP_FILE" ~/.zshrc | |
echo -e "\nSetup complete. Run 'source ~/.zshrc' or open a new terminal to apply changes." |
check your plugins
asdf plugin list all | grep "python " | awk '{print "asdf plugin add " $1 " " $2}' | bash
asdf plugin list all | grep "nodejs " | awk '{print "asdf plugin add " $1 " " $2}' | bash\n
asdf plugin list all | grep "rust " | awk '{print "asdf plugin add " $1 " " $2}' | bash\n
asdf plugin list all | grep "golang " | awk '{print "asdf plugin add " $1 " " $2}' | bash\n
asdf plugin list
install what you like version.
asdf install elixir latest
asdf install nodejs 22.14.0
asdf install python 3.8.0
asdf install rust latest
asdf install golang latest
install python plugin in one line. great! peace ✌
$ asdf current
Name Version Source Installed
elixir 1.16.3-otp-26 /Users/martin/.tool-versions false - Run `asdf install elixir 1.16.3-otp-26`
golang 1.23.2 /Users/martin/.tool-versions false - Run `asdf install golang 1.23.2`
nodejs 22.14.0 /Users/martin/Development/org_baryon_ai/npx-hi-garak/hello-mcp/.tool-versions true
python 3.10.15 /Users/martin/.tool-versions false - Run `asdf install python 3.10.15`
rust 1.84.0 /Users/martin/.tool-versions false - Run `asdf install rust 1.84.0`
$ asdf current
Name Version Source Installed
elixir 1.16.3-otp-26 /Users/martin/.tool-versions true
golang 1.23.2 /Users/martin/.tool-versions true
nodejs 22.14.0 /Users/martin/Development/org_baryon_ai/npx-hi-garak/hello-mcp/.tool-versions true
python 3.10.15 /Users/martin/.tool-versions true
rust 1.84.0 /Users/martin/.tool-versions true
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://asdf-vm.com/guide/upgrading-to-v0-16
Purpose of the Script
This script automates the configuration changes required when upgrading to ASDF version 0.16.0 from earlier versions. The purpose is to:
Safely back up the user's existing .zshrc configuration file
Remove any outdated ASDF-related configuration lines
Add the new required environment variables and PATH modifications for ASDF 0.16.0
Display the changes made to the configuration file
Guide the user on how to apply these changes
The script addresses the breaking changes introduced in ASDF 0.16.0, which was completely rewritten in Go and now requires different environment setup compared to previous Bash-based versions. It helps users migrate smoothly without losing their existing ASDF data directory settings.