-
Notifications
You must be signed in to change notification settings - Fork 923
zsh: command not found: sqlc #2985
-
Version
1.23.0
What happened?
I installed sqlc using go install github.com/sqlc-dev/sqlc/cmd/sqlc@latest
If I run sqlc version it says
zsh: command not found: sqlc
my go version - go1.21.3 darwin/arm64
I'm a newbie to go. Do I have to add anything to path or something like that?
What operating system are you using?
MacOS
Beta Was this translation helpful? Give feedback.
All reactions
The documentation suggest GOBIN=$GOPATH/bin
, so yes go/bin should be good
The directory where executables outside the Go distribution are installed using the go command. For example, go install golang.org/x/tools/cmd/godoc@latest downloads, builds, and installs $GOBIN/godoc. By default, $GOBIN is $GOPATH/bin (or $HOME/go/bin if GOPATH is not set). After installing, you will want to add this directory to your $PATH so you can use installed tools.
Note that the Go distribution's executables are installed in $GOROOT/bin (for executables invoked by people) or $GOTOOLDIR (for executables invoked by the go command; defaults to $GOROOT/pkg/$GOOS_$GOARCH) instead of $GOBIN.
Replies: 7 comments
-
Hey @dmgcoding, one quick question, do you have set the $GOBIN
env var set? Make sure you have it set
Beta Was this translation helpful? Give feedback.
All reactions
-
Hey @dmgcoding, one quick question, do you have set the
$GOBIN
env var set? Make sure you have it set
what should the path be? to the go>bin folder?
Beta Was this translation helpful? Give feedback.
All reactions
-
The documentation suggest GOBIN=$GOPATH/bin
, so yes go/bin should be good
The directory where executables outside the Go distribution are installed using the go command. For example, go install golang.org/x/tools/cmd/godoc@latest downloads, builds, and installs $GOBIN/godoc. By default, $GOBIN is $GOPATH/bin (or $HOME/go/bin if GOPATH is not set). After installing, you will want to add this directory to your $PATH so you can use installed tools.
Note that the Go distribution's executables are installed in $GOROOT/bin (for executables invoked by people) or $GOTOOLDIR (for executables invoked by the go command; defaults to $GOROOT/pkg/$GOOS_$GOARCH) instead of $GOBIN.
Beta Was this translation helpful? Give feedback.
All reactions
-
@dmgcoding Have you taken a look at our installation guide? You have a few options to install sqlc.
Since you're on macOS, I'd suggest using brew install sqlc
.
If you want to use go install
, you need to make sure that $GOBIN
is on your path, as @davidorozcog said.
Good luck!
Beta Was this translation helpful? Give feedback.
All reactions
-
❤️ 1
-
GOBIN is set to the go>bin file path. Still it is the same
Beta Was this translation helpful? Give feedback.
All reactions
-
I see sqlc executable inside go/bin folder. If I open that it says
`/Users/drexter/go/bin/sqlc ; exit;
drexter@Mohameds-MacBook-Air ~ % /Users/drexter/go/bin/sqlc ; exit;
zsh: killed /Users/drexter/go/bin/sqlc
Saving session...
...copying shared history...
...saving history...truncating history files...
...completed.
[Process completed]`
Beta Was this translation helpful? Give feedback.
All reactions
-
brew install works.
Beta Was this translation helpful? Give feedback.