Unable to install flyclt: mkdir: cannot create directory ‘/<user>’: Permission denied

When I run the command

curl -L https://fly.io/install.sh | sh

This is the output

mkdir: cannot create directory ‘/my-user-name’: Permission denied

I have no idea why it tries to create a directory called /my-user-name, I have no idea if I fucked up with something prior to the installation or something like that.


We need some more info to know what’s going on I think:

What type of computer/OS are you on? Are you running as user root? Perhaps in a server or Docker environment?

Cram as much extra info in as you can, it’ll help a lot!

I’m using a simple Ubuntu and I’m running as root.

Yesterday I remember I was trying to install the toolkit, but found a different error.

I followed the steps here Getting flyctl: command not found error post install - #8 by tooongs

However, nothing resolved and I tried to re-install the tool from scratch today. The error I get now is the one posted on the original post.

Well, something’s definitely weird. It almost sounds like $HOME and/or $PATH isn’t set.

You can inspect the install script (it’s pretty simple) here: https://fly.io/install.sh

And perhaps run those steps manually OR just check out if the set variables output the expected stuff.

For example, the results (variables set) for these seem relevant to investigate:



Seems like it worked!

Now however I have the same problem as yesterday:

flyctl was installed successfully to /home/user-name/.fly/bin/flyctl
Manually add the directory to your $HOME/.bash_profile (or similar)
export FLYCTL_INSTALL=“/home/user-name/.fly”
Run ‘/home/user-name/.fly/bin/flyctl --help’ to get started

Basically I can launch flyctl by prepending the whole file path. How do I solve it ?

You’ll need to add /home/user-name/.fly/bin to your $PATH variable for your user, which in Ubuntu is typically something that can be set in $HOME/.bashrc or $HOME/.bash_profile.

It sounds like maybe(!?) something is wonky with your Ubuntu installation (or we’re missing some piece of the puzzle), but in general adding to $PATH is like this in Ubuntu: environment variables - How to add a directory to the PATH? - Ask Ubuntu

1 Like

Thanks man, Helped a lot

1 Like