I try to install LND like this:

git clone https://github.com/lightningnetwork/lnd
cd lnd
sudo make install

I get the following error:

/bin/sh: 1: go: not found
make: *** [Makefile:112: install] Error 127

Go is installed. Go version:

go version go 1.20.2 linux/arm

.profile PATH is exported:

export PATH=$PATH:/usr/local/go/bin

.bashrc contains:

export GOPATH=~/go
export PATH=$PATH:$GOPATH/bin

Thanks in advance

1 Answer 1


Your shell cannot find the go binary in the PATH thats because when you use sudo the command is run in a new environment and some environment variable can not be there like PATH Here is how to fix that:

open a terminal then open the sudo configuration file in a text editor with sudo visudo then add :/usr/local/go/bin at the end of Defaults secure_path=

If you still have problem try to reinstall your go

  • The -E flag was not the solution but got me on the right track. Change your answer to something like this and I can mark it as correct answered. open sudo config with sudo visudo and add :/usr/local/go/bin at the end of Defaults secure_path =
    – Luca F
    Commented Mar 30, 2023 at 10:33
  • okay, thats a working solution :)
    – Saxtheowl
    Commented Mar 30, 2023 at 18:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.