I use flyctl through Ubuntu in WSL2, installed via curl -L https://fly.io/install.sh | sh. After successful installation, I follow the instructions to add the directory to $HOME/.bash_profile:
Everything works as normal until I close the WSL2 window. When I open a new WSL2 window, I receive flyctl: command not found and have to reinstall flyctl again.
What can I do to make the installation persistent?
Hmmm…looks like your .bash_profile is probably not being read when your terminal is being started. I believe a login shell with “bash -l” or moving the installation command in .bashrc may work.
I thought the export lines were being added to my profile, but they weren’t. In my WSL2 instance, the file is ~/.profile, not ~/.bash_profile. I manually added:
I am running Ubuntu 20.04.4 LTS and was facing this issue. By adding the below commands at the end of the .bashrc file by opening it in the nano editor I was able to fix it