RESOLVED: Unable to install DFINITY Canister SDK on Ubuntu

Hi everyone,

As the title suggests, I wasn’t able to install the SDK on Ubuntu.

I posted the full details on Stack Overflow:

Thank you in advance.

1 Like

I think that ~/bin is probably missing from your path. Details posted on SO.


As @max indicated, the dfx binary is missing from your PATH environment variable. Run the following commands to resolve this issue.

echo 'export PATH=$HOME/bin:$PATH' >> ~/.bash_aliases
source ~/.bash_aliases
1 Like

@enzo / @max ,

As my SO post mentions, the script doesn’t even create the dfx directory under /bin; the only thing that the script creates is the script under .cache directory.

Perhaps someone else can confirm, but I believe dfx is installed at $HOME/bin to avoid calling sudo at installation. Yes, everything else is written to $HOME/.cache/dfinity

1 Like

Actually I tried a couple of things before writing my post:

  1. Create the dfx directory myself, but after running the script it was still empty.
  2. Run the script with sudo; the directory was created under ~/root/bin/dfx but it was empty as well. Regardless, I don’t want to install things with sudo. The script should work as it is with my user.

It sounds like the script works fine, but perhaps not the behavior you expected? On the latest Ubuntu, the script should install the dfx binary in $HOME/bin and all other SDK-related content in the $HOME/.cache/dfinity directory. Obviously, yes, as you point out, if you run with sudo, then HOME=/root. If you want to use the dfx binary then $HOME/bin must be in your PATH environment variable. The script outputs the location of the binary explicitly. Perhaps it should also mention something your PATH environment variable.

1 Like

@enzo, how does it sound to you that the script is working if I’m saying that it’s not creating a directory called dfx under ~/bin?!!!
There is no folder called dfx, there is no binary because there is no folder called dfx, and even if I create the folder manually myself and run the installation script again, it does not place any files in the ~/bin/dfx directory.

Have you have had a look at the output of my Ubuntu terminal in my post in Stack Overflow?

dfx is the executable, it’s not a directory. This executable should itself be in the bin directory?


Can you run it by typing ~/bin/dfx ?

1 Like

Sorry if I misunderstood! The directory $HOME/bin should get created if it does not exist. The executable binary should be written to $HOME/bin/dfx. If you are not seeing the binary, then this is a problem. I don’t see anything peculiar about the output you posted to Stack Overflow. Seems like you just need to add the bin to your PATH, which follows Unix conventions. Again, if you’re not seeing the bin directory then this is a problem. Unfortunately, I won’t be able to help much more without a reproducible environment. Personally, I run Ubuntu LTS 20.04 on my laptop here, and it’s my OS of choice for every IC project build environment. I’ve never experienced the behavior you’re describing and cannot reproduce.


Ok now it all makes sense, I thought the script will create a directory called dfx and put the binary inside of it.

Thanx everyone for your input and time.

@max I accepted your answer on Stack Overflow.