How to upgrade dfx to version other than latest via the CLI

I would love to use the latest 0.9.0 release of dfx, but am currently unable to do so via the cli.

>% dfx upgrade
Current version: 0.8.4
Fetching manifest https://sdk.dfinity.org/manifest.json
Already up to date

This makes sense as if you visit the manifest file that the url link redirects to, or https://download.dfinity.systems/sdk/manifest.json. Here the latest version is still tagged as 0.8.4, but 0.9.0 is listed on the list of versions

{
    "tags": {
        "latest": "0.8.4"
    },
    "versions": [
        "0.5.0",
        "0.5.2",
        "0.5.3",
        "0.5.4",
        "0.5.5",
        "0.5.6",
        "0.5.7",
        "0.5.8",
        "0.5.11",
        "0.5.15",
        "0.6.0",
        "0.6.1",
        "0.6.2",
        "0.6.3",
        "0.6.4",
        "0.6.6",
        "0.6.7",
        "0.6.9",
        "0.6.10",
        "0.6.11",
        "0.6.12",
        "0.6.13",
        "0.6.14",
        "0.6.16",
        "0.6.17",
        "0.6.18",
        "0.6.20",
        "0.6.21",
        "0.6.22",
        "0.6.23",
        "0.6.24",
        "0.6.25",
        "0.6.26",
        "0.7.0-beta.0",
        "0.7.0-beta.1",
        "0.7.0-beta.2",
        "0.7.0-beta.3",
        "0.7.0-beta.4",
        "0.7.0-beta.5",
        "0.7.0-beta.6",
        "0.7.0-beta.7",
        "0.7.0-beta.8",
        "0.7.0",
        "0.7.1",
        "0.7.2",
        "0.8.0",
        "0.8.1",
        "0.8.2",
        "0.8.3",
        "0.8.4",
        "0.9.0"
    ]
}

It feels like the CLI would benefit from an option where I can specify the version that I want to install, a dfx install 0.9.0 command similar to what nvm has https://github.com/nvm-sh/nvm. Thoughts?

There tends to be a short waiting period before the new versions are promoted to latest, but you can always install a specific version by setting a DFX_VERSION variable like so:

DFX_VERSION=0.9.0 sh -ci "$(curl -fsSL https://smartcontracts.org/install.sh)"

7 Likes

Great, thanks for the help @Ori!

As a feature request for dfx 0.9.x, would love to see this mixed into the CLI :slight_smile: