Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

zsh: command not found: sqlc #2985

Answered by davidorozcog
dmgcoding asked this question in Q&A
Discussion options

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

You must be logged in to vote

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

Comment options

Hey @dmgcoding, one quick question, do you have set the $GOBIN env var set? Make sure you have it set

You must be logged in to vote
0 replies
Comment options

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?

You must be logged in to vote
0 replies
Comment options

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.

You must be logged in to vote
0 replies
Answer selected by kyleconroy
Comment options

@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!

You must be logged in to vote
0 replies
Comment options

GOBIN is set to the go>bin file path. Still it is the same

You must be logged in to vote
0 replies
Comment options

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]`

You must be logged in to vote
0 replies
Comment options

brew install works.

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
Converted from issue

This discussion was converted from issue #2984 on November 16, 2023 17:05.

AltStyle によって変換されたページ (->オリジナル) /