Skip to content

Instantly share code, notes, and snippets.

@timhughes
Last active May 23, 2023 11:16
Show Gist options
  • Save timhughes/b510d67b24647ec4744dd5e4ab96b9de to your computer and use it in GitHub Desktop.
Save timhughes/b510d67b24647ec4744dd5e4ab96b9de to your computer and use it in GitHub Desktop.
asdf install multiple versions

Add the following to your .bashrc or wherever you keep this information. See https://asdf-vm.com/guide/getting-started.html#_3-install-asdf for details if you aren't using bash

ASDF_DIR="${HOME}/.asdf"
if ! [[ -d "$ASDF_DIR" ]]; then
    git clone https://github.com/asdf-vm/asdf.git "$ASDF_DIR" --branch v0.11.3
fi
if [[ -d "$ASDF_DIR" ]]; then
    . "${ASDF_DIR}/asdf.sh"
    . "${ASDF_DIR}/completions/asdf.${shell}"
fi

Source the file. adjust filename to suit.

source ~/.bashrc

Install the python plugin for asdf.

asdf plugin add python

Install the supported versions of python. Adjust the numbers to suit.

for i in {11..7} ; do asdf install python latest:3.$i; done

Make them all available in with the default being the first one in the list.

asdf global python latest:3.{11..7}
@timhughes
Copy link
Author

timhughes commented Mar 31, 2023

Install a bunch of plugins

PLUGINS='nodejs ruby poetry golang yq jq'
for X in $PLUGINS; do asdf plugin add $X; done

Ensure latest of all plugins

asdf plugin update --all ; for X in $(asdf plugin list); do asdf install $X latest; asdf global $X latest; done

Nodejs latest doesn't work on amazon linux 2 , the latest LTS version that works is 16 https://nodejs.org/en/download/releases

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