air icon indicating copy to clipboard operation
air copied to clipboard

No .air folder after installing with go install with Go 1.24.3

Open pommepommee opened this issue 7 months ago • 1 comments

Following the README, it's impossible to launch air in a terminal. The readme refers to a ~/.air/ folder, whereas the command go install github.com/air-verse/air@latest creates a ~/go/ folder.

Image

pommepommee avatar May 26 '25 22:05 pommepommee

Same here, using Ubuntu 22.04.5 LTS with WSL.

Installed golang using .tar from go.dev rm -rf /usr/local/go && tar -C /usr/local -xzf go1.24.3.linux-amd64.tar.gz

alexjoseps avatar Jun 05 '25 17:06 alexjoseps

Have this issue as well in linux 6.12.33-1-lts, but on Go version 1.24.4.

vihutr avatar Jun 22 '25 03:06 vihutr

same here in macOS 15.5 go 1.24.4

illank86 avatar Jun 26 '25 05:06 illank86

✅ Fix: air command not found after go install or if air init is not working

If you're seeing this error when trying to use air:

air: command not found

even after installing it with:

go install github.com/cosmtrek/air@latest

👉 The problem is that Go installs binaries to your local $HOME/go/bin directory, but this path is not included in your system's PATH environment variable by default — especially on Linux systems like Ubuntu or Pop!_OS.


🛠️ Solution: Add $HOME/go/bin to your PATH

Update your shell config file to include the Go binaries directory.

For Bash (~/.bashrc)

export PATH="$HOME/go/bin:$PATH"
source ~/.bashrc

For Zsh (~/.zshrc)

export PATH="$HOME/go/bin:$PATH"
source ~/.zshrc

This tells your terminal where to find tools installed via go install.


After adding this above export path, my bash config e.g. .bashrc now has two export path, like this :

Image

✅ Test it

Now open a new terminal or run:

source ~/.bashrc   # or ~/.zshrc

Then check:

which air

Expected output:

/home/your-username/go/bin/air

Now you can successfully run these command in your project root to enjoy hot reload 💯

air init
air

📌 Notes

  • This solution worked for me on Pop!_OS (Ubuntu-based), but applies to any Linux where $HOME/go/bin isn't in PATH.
  • This issue affects all Go tools installed via go install, not just air.

Alhamdulillah, this fixed it for me. Posting here in case it helps someone else struggling with the same thing. 🙌

MotiurRahmanSany avatar Aug 07 '25 14:08 MotiurRahmanSany