Deploy error: "flyctl": executable file not found in $PATH

I’m trying to do a deploy locally (not done one for months but it used to work) from my Mac and have started getting this error. Any Mac experts know the fix? Is it something at my end or with the builder?

$ flyctl deploy
Deploying [name]
==> Validating app configuration
--> Validating app configuration done
Services
TCP 443 ⇢ 8686
UDP 514 ⇢ 514
Waiting for remote builder fly-builder-patient-shadow-851... connecting ⣷ 
Error error connecting to docker: error establishing agent: exec: "flyctl": executable file not found in $PATH

Hmm. I’m not running docker locally. But the remote builder shouldn’t need that.

$ flyctl version
flyctl v0.0.236 darwin/amd64 Commit: 01912e1 BuildDate: 2021-09-03T19:13:04Z

My paths work fine. Again, outside of the builder all looks fine:

$ cat /etc/paths
/usr/local/bin
/usr/bin
/bin
/usr/sbin
/sbin

Thanks

Will you run where flyctl?

That looks like it can’t find the binary to start the agent we run to talk to wireguard.

Seems where is not working but I found it:

~ $ where flyctl
-bash: where: command not found
~ $ type -a flyctl
flyctl is /Users/name/.fly/bin/flyctl
~ $ echo $PATH
/Users/name/google-cloud-sdk/bin:~/.fly/bin:~/.composer/vendor/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin

… so it should be there. Unless it can’t resolve ~?

Ah … does the builder run where internally? And so can’t find the path? Because it would get command not found, presumably, like I do.

Erm, I meant which flyctl. Try that one? This is a super weird error I have not seen before.

Ah. Strange! I confirmed which is there … but seems like it can’t find flyctl:

~ $ type which
which is hashed (/usr/bin/which)
~ $ which
usage: which [-as] program ...
~ $ which flyctl
~ $ 

Empty.

Yet flyctl must be in PATH for me to call it. It works for me. And it is there:

$ cd ~/.fly/bin
bin $ ls -l
total 75704
lrwxr-xr-x  1 name  staff    39B  4 Sep 02:58 fly@ -> /Users/name/.fly/bin/flyctl
-rwxr-xr-x  1 name  staff    37M  3 Sep 20:13 flyctl*

This is a wild guess, but did you install from Homebrew previously, and then install again with our installer?

Also if you run this, does it help?

export "PATH=$(dirname ~/)/$(basename ~/)/.fly/bin:$PATH"

I’m wondering if the ~/ in the path is throwing something for a loop.

1 Like

It’s entirely possible I did that months ago. Possibly trying to fix some other issue. And once it worked, I left it (well, apart from flyctl version update).

However the good news is the …

Unless it can’t resolve ~?

suspicion was correct. Your fix solved it :slight_smile: Yay.

After running that export command and so getting the full path into the PATH, the builder found it and proceeded to deploy (which failed, ha, but that’s an issue with my app, not the builder!)

Great work. Thanks Kurt!

That’s bonkers. Will you see what echo $HOME shows you? You shouldn’t have ~/ in your path, I don’t think, but I’m pretty sure we don’t add it.

~ $ echo $HOME
/Users/name

Looks fine.

I mean there is another ~ in the PATH, for composer:

:~/.fly/bin:~/.composer/vendor/bin

… and we can’t rule out me having edited that PATH. Perhaps trying to get fly and composer working at some point months/years back. And given both do work (it was just the builder didn’t) I would have left the PATH as it was. With ~. So I don’t know where the paths originally came from.

But it works. So don’t worry.