Failing to instlal arduino_cli on raspberry

Hey guys, the title says it all, I tried to install arduino_cli on my raspberry, but several things are going wrong.
First of all, when I do:

curl -fsSL https://raw.githubusercontent.com/arduino/arduino-cli/master/install.sh | sh

I get this:

Downloading https://downloads.arduino.cc/arduino-cli/arduino-cli_0.20.2_Linux_ARMv7.tar.gz                                                                                                                                                             Mv7.tar.gz
An existing arduino-cli was found at . Please prepend "/home/pi/bin" to your $PATH or remove the existing one.                                                                                                                                                             TH or remove the existing one.
arduino-cli  Version: 0.20.2 Commit: 13783819 Date: 2021-12-09T13:32:05Z installed successfully in /home/pi/bin

That line in the middle there is weird, becouse this is an entirely clean and new install of ubuntu for raspberry, and also its found at... nothing? but in the end it says it installed succesfully, so I thought what the h. but when I tried to simply do

arduino_cli --version

it said:

-bash: arduino-cli: command not found

so I decided to do what it suggested by adding to the path like so:

PATH=$PATH:~/home/pi/bin

But the problem persists.
I also tried installing it via snap following their website: Install Arduino CLI on Raspberry Pi using the Snap Store | Snapcraft

But no luck there either.

Anyone here have a clue whats going on, or should I try my luck in a more raspberry focussed forum?
Thanks in advance

Thanks for your report @high-tech-potato!

I spotted the problem here:
https://github.com/arduino/arduino-cli/blob/d458040fea6f8d6148acad1bc0e3a0e2e8d8b27d/install.sh#L190

  EXECUTABLE_PATH="$(command -v $PROJECT_NAME)"
  if [ "$?" = "1" ]; then

The exit status of command when the command was not found turns out to be shell dependent. On Bash it is 1, but in POSIX sh, it is instead 127. So this conditional is not evaluating as true in the case where the arduino-cli command was not found.

I'll get this bug fixed ASAP.
For now, please just ignore this message. It is only a convenience feature. If you got to this point in the installation then it was successful and you now have Arduino CLI on your machine.

That is because it is not in your path. If you specify the path to the executable:

/home/pi/bin/arduino-cli --version

then you will not get that "command not found" error.

You messed up the path by adding that ~ prefix.

Arduino CLI was installed at /home/pi/bin. ~ is an alias for /home/pi when you are logged in as the pi user, so the path you specified was /home/pi/home/pi/bin, which does not contain arduino-cli (and likely doesn't even exist).

The Snap package is not officially maintained by Arduino, but you are welcome to share details about that failure if you want assistance with it.

I think you are in good hands here.

I have submitted a proposed fix for this bug:

Will need to wait until next week for approval and deployment because it is already the weekend in Italy.

Thanks for the reply, you where correct, it was the ~ that was the mistake, always the small mistakes that trip us up.
But glad I was able to bring attention to an actual bug to.

The bug is now fixed in the Arduino CLI installation script:

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.