Skip to content

Instantly share code, notes, and snippets.

@hongsw
Created March 21, 2025 02:09
Show Gist options
  • Save hongsw/39552ac7807bdac2f025f3b84951a4f4 to your computer and use it in GitHub Desktop.
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…
#!/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."
@hongsw
Copy link
Author

hongsw commented Mar 21, 2025

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 ✌

@hongsw
Copy link
Author

hongsw commented Mar 21, 2025

$ 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