4

I'm following the steps found here to install DFINITY Canister SDK.
When I run the below command, directory dfx (under /bin) is not created and subsequently the dfx command is not recognized:

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

info: Executing DFINITY SDK install script, commit: dd2134837704e0daca074dd3fe09ee4ff6ebbf97

 DFINITY SDK 
 Please READ the following license: 

DFINITY Foundation -- All rights reserved. This is an ALPHA version
of the DFINITY Canister Software Development Kit (SDK). Permission is hereby granted
to use AS IS and only subject to the Alpha DFINITY Canister SDK License Agreement which
can be found here [https://sdk.dfinity.org/sdk-license-agreement.txt]. It comes with NO WARRANTY.


Do you agree and wish to install the DFINITY ALPHA SDK [y/N]?
y

info: Version found: 0.6.10
info: Creating uninstall script in ~/.cache/dfinity
info: uninstall path=/home/adel/.cache/dfinity/uninstall.sh
info: Checking for latest release...
Will install in: /home/adel/bin
info: Installed /home/adel/bin/dfx

adel@adel-VirtualBox:~$ dfx --version

Command 'dfx' not found, did you mean:

  command 'fx' from snap fx (11.1.0)
  command 'dfix' from snap dfix (0.3.5)
  command 'dx' from deb dx (1:4.4.4-12build2)
  command 'dex' from deb dex (0.8.0-2)
  command 'dfc' from deb dfc (3.1.1-1)
  command 'df' from deb coreutils (8.30-3ubuntu2)

See 'snap info <snapname>' for additional versions.

adel@adel-VirtualBox:~$ cd /bin
adel@adel-VirtualBox:/bin$ cd dfx
bash: cd: dfx: No such file or directory

Below is my Ubuntu version:

adel@adel-VirtualBox:~$ lsb_release -a

No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 20.04.1 LTS
Release:    20.04
Codename:   focal
Adel Rustum
  • 2,518
  • 2
  • 7
  • 15

8 Answers8

19

From the output of the install command it looks as if dfx is installed in /home/adel/bin/dfx. Can you verify that:

  1. dfx is indeed there?
test -e /home/adel/bin/dfx && echo yay found it || echo oh no

If not, it looks as if the install didn't work.

If yes, you can run it directly:

"$HOME/bin/dfx" --version
  1. Check that your path includes "/home/adel/bin"
echo "$PATH" | tr : "\n" | grep "$HOME/bin"

If not, you can add it with:

echo 'export PATH="$PATH:$HOME/bin"' >> "$HOME/.bashrc"

. "$HOME/.bashrc"

dfx --version
Dharman
  • 30,962
  • 25
  • 85
  • 135
Max Murphy
  • 1,701
  • 1
  • 19
  • 29
  • Max, like I mentioned in my post; nothing gets created, I should have been more detailed. I updated my post to clarify that directory `dfx` is not created; I also added the terminal output to show that. – Adel Rustum Oct 08 '20 at 14:29
  • 1
    I misunderstood the script logic and thought it will place the binary inside `~/bin/dfx` instead of `~/bin`. Now it all makes sense and works fine. – Adel Rustum Oct 08 '20 at 21:41
4

when I used the command

dfx --version

it didn't recognoze.

but when I used the complete path it worked.

sudo /home/osboxes/bin/dfx --version

dfx 0.8.0

2

I got the same problem. For some reason there is a ~/bin directory so first I delete it then follow the previous answer:

ubuntu@ip-172-31-81-158:~$ PATH=~/bin:$PATH
ubuntu@ip-172-31-81-158:~$ export PATH
ubuntu@ip-172-31-81-158:~$ sh -ci "$(curl -fsSL https://sdk.dfinity.org/install.sh)"
info: Executing dfx install script, commit: 0a3bd5b38e498f899c8074d734116c10e0e53ca5
info: Version found: 0.8.3
info: Creating uninstall script in ~/.cache/dfinity
info: uninstall path=/home/ubuntu/.cache/dfinity/uninstall.sh
info: Checking for latest release...
Will install in: /home/ubuntu/bin
info: Installed /home/ubuntu/bin/dfx
ubuntu@ip-172-31-81-158:~$ dfx --version
dfx 0.8.3
  • This does not really answer the question. If you have a different question, you can ask it by clicking [Ask Question](https://stackoverflow.com/questions/ask). To get notified when this question gets new answers, you can [follow this question](https://meta.stackexchange.com/q/345661). Once you have enough [reputation](https://stackoverflow.com/help/whats-reputation), you can also [add a bounty](https://stackoverflow.com/help/privileges/set-bounties) to draw more attention to this question. - [From Review](/review/late-answers/30351770) – Flair Nov 22 '21 at 05:08
0

you need to give it the path. run the code below and make sure to place the binary inside ~/bin instead of ~/bin/dfx

export PATH=$PATH:<REPLACE WITH YOUR INSTALLATION PATH>

you got your installation path at the bottom when you installed dfx where you find the ringt installion path

0

After installing DFX add your installed path on this line $ export PATH=$PATH:

Check that it has been added by running: echo "${PATH//:/$'\n'}"

Finally, restart Ubuntu again & run dfx --version it will definitely work and show you the current dfx version 0.11.0

0

Issue I faced below issue even after exporting path as mentioned below.

export PATH=$PATH:/home/*****/bin/dfx

Faced the same issue:

dfx --version
Command 'dfx' not found, did you mean:
  command 'fx' from snap fx (24.1.0)
  command 'dfix' from snap dfix (0.3.5)
  command 'dex' from deb dex (0.9.0-1)
  command 'dx' from deb dx (1:4.4.4-15)
  command 'dfc' from deb dfc (3.1.1-1)
  command 'df' from deb coreutils (8.32-4.1ubuntu1)
See 'snap info <snapname>' for additional versions

Solution

as mentioned above run the command after mentioning the path:

sudo /home/osboxes/bin/dfx --version

To find the path run the command

echo "${PATH//:/$'\n'}"

To resolve all issues: I strongly recommends follow most voted ans. line of code.

because for me dfx new my_app was not working but it worked after I ran below line of codes.

  1. test -e /home/navalega0109/bin/dfx && echo yay found it || echo oh no
  2. "$HOME/bin/dfx" --version
  3. echo "$PATH" | tr : "\n" | grep "$HOME/bin"
0

After installed on my local I got this message:

dfx-0.14.3-x86_64-linux.tar.gz: OK
Will install in: /home/akhisyabab/bin
info: Installed /home/akhisyabab/bin/dfx

in official documentation of IC, dfx should be located at /usr/local/bin/dfx, So I just link the location

sudo ln -s /home/akhisyabab/bin/dfx /usr/local/bin/dfx

It works for me. Thanks

akhisyabab
  • 179
  • 2
  • 7
0

It will work once you restart Ubuntu

  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Aug 21 '23 at 15:51
  • This does not provide an answer to the question. Once you have sufficient [reputation](https://stackoverflow.com/help/whats-reputation) you will be able to [comment on any post](https://stackoverflow.com/help/privileges/comment); instead, [provide answers that don't require clarification from the asker](https://meta.stackexchange.com/questions/214173/why-do-i-need-50-reputation-to-comment-what-can-i-do-instead). - [From Review](/review/late-answers/34859193) – Ram Chander Aug 24 '23 at 14:02