The dfx version manager (dfxvm) version 1.0.0 is released!

We’ve released version 1.0.0 of the dfx version manager.

You can install it with

sh -ci "$(curl -fsSL https://sdk.dfinity.org/install.sh)"

The install scripts at internetcomputer.org and smartcontracts.org have not yet cut over.

If you are installing dfx in CI, you’ll need to update your method of doing so.

There are two main methods: GitHub action or Manual

GitHub action: GitHub - dfinity/setup-dfx: GitHub Action to set up dfx

jobs:
  example-job:
    runs-on: ubuntu-latest 
    steps:
    - name: Checkout repository
      uses: actions/checkout@v4
    - name: Install dfx
      uses: dfinity/setup-dfx@main
    - name: Confirm successful installation
      run: dfx --version

Manual:

  1. Set DFXVM_INIT_YES=true so that the installer bypasses prompts:
$ DFXVM_INIT_YES=true sh -ci "$(curl -fsSL https://sdk.dfinity.org/install.sh)"
  1. Add the dfxvm bin path to your PATH depending on OS:
# Linux:
"$HOME/.local/share/dfx/bin"

# Macos:
"$HOME/Library/Application Support/org.dfinity.dfx/bin"

Depending on how your script runs, you could also source the env script, one of these:

# Linux:
source "$HOME/.local/share/dfx/env"

# Macos:
source "$HOME/Library/Application Support/org.dfinity.dfx/env"
14 Likes

This is awesome! A huge improvement to the DX working with DFX.

2 Likes

So the current way DFX_VERSION=0.16.1 sh -ci "$(curl -fsSL https://sdk.dfinity.org/install.sh)" won’t work anymore? We can’t just install a specific version like this?

1 Like

Is there a way to just install a version directly without the dfxvm? All of our CI tests are failing on we haven’t updated any of our documentation or notified anyone about this, and seems we have to now. Would be great if we could have a way to keep the original behavior during the transition, if it’s available.

1 Like
DFXVM_INIT_YES=true DFX_VERSION=0.16.1 sh -ci "$(curl -fsSL https://sdk.dfinity.org/install.sh)"

You do still need to add the dfxvm bin directory to the path. I should have posted about this when I announced the dfxvm soft launch.

3 Likes

Thanks for your great work! wahoo~
Already using it ~ Love it

Just a feedback, it would be good if this big updates did not disrupt existing workflows that were compatible with previous versions of the DFX installation. This can be challenging for individual developers to keep up with all the updates and adjust their code accordingly since their CI could break.

5 Likes

It looks like the other install scripts were also migrated (i.e. smartcontracts.org), or at least once dfxvm is installed attempting to install from this url using the old command forwards to dfxvm. Was this intentional?

I’m all migrated over though now, and it’s great, but as Jordan and other mentioned it did break CI.

Since this overwrites the previous dfx path, for future dfx releases it would be nice if there are instructions included for going back and forth between the new and the old system (if one needs to locally).

Thanks again for dfxvm though - loving it! :clap:

2 Likes

Hi there.

I have to say that this kind of surprise breaking change of a reference install script isn’t welcome at all.

We have a custom docker image that we use in our Gitlab CI/CD pipelines.
This docker image has its own CI/CD and all of a sudden we are not only unable to create images for new dfx releases, but also unable to update older dfx version’s images to our evolving needs.

Here is what our Dockerfile looks like now, in my attempt to fix this:

...
ARG DFX_VERSION
RUN DFXVM_INIT_YES=true sh -ci "$(curl -fsSL https://sdk.dfinity.org/install.sh)"
RUN . $HOME/.local/share/dfx/env
ENV PATH="$HOME/.local/share/dfx/bin:$PATH"
...

Apparently, dfx is correctly installed, dfxvm as well even if not needed in our case, and both binaries are present in $HOME/.local/share/dfx/bin/.
But the PATH doesn’t seem to be updated correctly, even running the env script (I also tried with RUN ["/usr/bin/bash", "-c", "source $HOME/.local/share/dfx/env"] and several other syntaxes, with no success, in the test job for that image, the result is always the same:

Any idea ??!

I apologize for not giving more advance notice about these breaking changes to CI.

Additionally, while I had thought it wasn’t feasible to release dfxvm without breaking changes for CI, in hindsight there are probably things we could have done.

In the case of your Dockerfile, the problem may be that HOME isn’t something that ENV knows about. In that case, this might work:

ENV PATH="/root/.local/share/dfx/bin:$PATH"

That worked. :+1: Thanks.