Getting flyctl: command not found error post install

Hi,

I’ve just installed FLYCTL on my linux system and when i try to sign up using flyctl auth signup, I get
lyctl: command not found.

Is there any additional step i need to follow?

Thanks in advance

Did you use the recommended install script?

Only you can take a look at the https://fly.io/install.sh that runs and can see at the bottom that should try and add it to the PATH so that you can just type flyctl (or fly) without any prefix (like /usr/bin/flyctl or /usr/local/bin/flyctl.

So … either it has not been installed or it has been installed, but it has not been added to the PATH and so can’t be run with just flyctl. Maybe take a look at the /bin folders and see if it’s there?

Hi @greg I have the same problem. I’ve tried all way to fix that but i couldn’t succeed. can you please help me !

hi! If you’re getting a “flyctl: command not found error”, then you probably just need to configure your shell to add your fly install to your $PATH for all new shells you start with whichever terminal app you’re using.

How to do this will depend on what shell you’re using, since you’d use a different config file with each one.

What happens when you run the following?

cd ~ ; pwd
.fly/bin/flyctl version
1 Like

Hi @victor-barh : no need for me, @eli is on the case :slight_smile: Check :arrow_up:

1 Like

I’m getting thisflyctl v0.0.381 linux/amd64 Commit: ed6bc2a6 BuildDate: 2022-08-23T14:17:58Z. so how can i add it to my PATH

You’ll need to figure out what shell you’re using on your local machine. For most desktop Linux users, this will be bash by default:

That said, it may vary depending on your distro or setup. Running echo $SHELL will let you know what shell you’re running. If it’s not bash, check that project’s documentation website for specific instructions.

If you are running bash, then you can add flyctl to your path by running the following:

NOTE 1: make sure you replace "<your-user>" with the name of your actual user (to double-check this, make sure it matches the output of whoami )

export FLYCTL_INSTALL="/<your-username>/.fly"
export PATH="$FLYCTL_INSTALL/bin:$PATH"

Then you’ll want to open your ~/.bashrc file [see note 2] file your favorite text editor, append the above two lines to it and save. Finally, it’s convenient to tell your enviroment you want to make this the default for new shells:

source ~/.bashrc 

NOTE 2: there are other places where you can configure bash behavior. In this case we configured the current user’s bash to know where to find flyctl.

It’s not necessary knowledge to use fly, but knowing all the configuration options for your shell is worthwhile if you’re planning on spending much time there. Here’s a good overview of all the different ways bash can be configured

If you prefer more of a zine/blog-style resource, and want to learn bash specifically as a newer Linux user, I’ve yet to see a better resource than Bite Size Bash :smile:

2 Likes

Hi, I’m receiving the same error and I ran that command gives me this:

.fly/bin/flyctl version
/home/tongs
flyctl v0.0.383 linux/amd64 Commit: 16a17b20 BuildDate: 2022-08-25T22:18:50Z

In that case, you’ll probably want to go through the above listed steps-- adding flyctl to your $PATH will let you use the flyctl command without having to specify where it is every time. Have you tried the steps outlined above yet? If so, what what the result?

Hi there, jumping in as I had the same error. In fact when I ran the install.sh script it actually gave me the following output which supports what you’ve been advising:

flyctl was installed successfully to /var/services/homes/[USERNAME]/.fly/bin/flyctl
Manually add the directory to your $HOME/.bash_profile (or similar)
  export FLYCTL_INSTALL="/var/services/homes/[USERNAME]/.fly"
  export PATH="$FLYCTL_INSTALL/bin:$PATH"
Run '/var/services/homes/[USERNAME]/.fly/bin/flyctl --help' to get started

I ran both export lines and added both to my .bashrc file, can confirm this works, thanks for the advice.

3 Likes

In case anyone has this error on windows this is solution:

$env:Path += ';C:\Users\[USERNAME]\.fly\bin' 

Just run it in powershell

Edit: it works… until terminal reboot. Any persistent solution?

1 Like

Hi eli,

I’m having an identical error, but the steps you’ve mentioned haven’t fixed it. Flyctl has been successfully installed, as verified by running .fly/bin/flyctl version in the home directory and getting back ‘flyctl v0.0.441 linux/amd64 …’, and have run both of the export commands (both in the home directory and in the .fly/bin directory) and added them both to my .bashrc file, yet I still cannot use the flyctl tool from the home directory without using /.fly/bin first. Any ideas why this might be happening?

Thanks.

It’s hard to say off the bat, but if you’re having trouble with this, I’d recommend making sure that the changes to ~/.bashrc and/or the local exports are present in the current shell by running

echo $FLYCTL_INSTALL
echo $PATH

Basically, you’ll want to make sure that the $FLYCTL_INSTALL settings are somewhere in your $PATH so that bash knows where to find it. How that’s configured to happen can vary quite a bit depending on your local setup.

It’s possible that something else in your setup is overwriting the changes we’re trying to make to the $PATH, or that these changes aren’t making it to the shell session that you’re using to run flyctl commands. For example, this will (and does :sweat_smile: ) happen if you used a different, newer terminal window to make these changes.

If you tried all possibilities and it didn’t work, just run .fly/bin/flyctl <your_fly_command> . This will serve as an alternative to the fly and flyctl commands

1 Like

I was having the same issue and followed the advice above but it still wasn’t working :pensive: adding the following to the end of the ~/.bashrc file fixed the problem though:

export FLYCTL_INSTALL="/home/<your-username>/.fly"
export PATH="$FLYCTL_INSTALL/bin:$PATH"

It’s only a small change but it seems to have done the trick for me!

1 Like

Can anyone share a working specs to install and use flyctl on windows?

This worked for me: Install flyctl · Fly Docs

Thanks for reply! I installed it, loged in, added PATH, but still get this error:

It appeared I just needed to reload vs code :face_with_symbols_over_mouth:

1 Like

This is what I’m seeing. Note C:\Users\rubys\.fly\bin in my path.

If you are open to recommendations, I strongly encourage WSL2. It plus Windows Terminal and VSCode are an awesome combination.

1 Like