sql-migrate
sql-migrate copied to clipboard
sql-migrate CLI tool not being added to path with the installation command provided. `zsh: command not found: sql-migrate`
Tried using Go 1.18 (the latest release as of March 20, 2022) and Go 1.17.8 (latest older release) on my Macbook Pro running MacOS Monterey Version 12.1 (21C52). The sql-migrate command is not getting added to the PATH variable. I have looked extensively and don't find a solution to adding this to the path without doing it manually. I would like to not do it manually.
Basically I'm getting zsh: command not found: sql-migrate when I try to run sql-migrate command on my terminal running zsh. Even when I switch to bash it doesn't work.
I can see that the package is being installed in $HOME/go/pkg/mod/github.com/rubenv/[email protected].
Is this a known issue or am I missing something? How can I solve this?
After researching a little bit, I found that the binary file was not being generated anymore by the go get command and that functionality has been transferred over to the go install command. So to resolve this, the following needs to be run:
go install github.com/rubenv/sql-migrate/...@latest
I am on macbook pro Intel
My Go version is
go1.18.1 darwin/amd64
I did use for installation
go install github.com/rubenv/sql-migrate/...@latest
Still When I am doing sql-migrate --help, I am getting this error
sql-migrate: command not found
@krushanu can you run ls $GOPATH and then make sure a bin folder exists there. Now, check ls $GOPATH/bin, there should be an sql-migrate file in that folder.
I am thinking your GOPATH has not been set correctly. Add it to your .zshrc file. Mine looks like this:
export GOPATH=$HOME/go
export PATH=$GOPATH/bin:$PATH
export GOBIN=$GOPATH/bin
@nikhil1011 Thanks for the guidance. Tried the above but no change in the error. Also tried to put it in the .bash_profile. No change.
Advice about go install worked, I'd say the README needs to be updated. @rubenv thoughts?
@outime Merged the PR #215
Should be OK now. Sorry for taking this long.