Closed lchreal6 closed 7 years ago
Maybe you need to set the GOPATH + PATH in your system but you still can use it using the absolute path to the primitive binary file
~/gocode/bin/primitive -i 1.jpg -o 1.jpg -n 100
Did you install golang? Did you install primitive with:
go get -u github.com/fogleman/primitive
Make sure to add the go path to your .bashrc file:
# Add go
export PATH=$PATH:/usr/local/go/bin:/home/bernard/gosrc/bin
export GOPATH=$HOME/gosrc
Bernard
You might also want to put $GOPATH/bin
on your $PATH
.
In case other OSX users land here wanting to run this package from the command line, I got going by installing go, then adding the following to my bash profile:
######
# GO #
######
export GOPATH=/Users/YOUR-USERNAME-HERE/go
export PATH=$GOPATH/bin:$PATH
I then ran source ~/.bash_profile
, and reinstalled the package go get -u github.com/fogleman/primitive
. Typing which primitive
then gave a response...
@duhaime's solution will install in your home directory. If you don't want to do that, I recommend the following solution for macOS:
Run brew install go
Add the following lines to your .bash_profile
:
# Go
export GOPATH=/usr/local/opt/go
export PATH=$GOPATH/bin:$PATH
Run source ~/.bash_profile
to reload your profile.
Then install primitive with go get -u github.com/fogleman/primitive
In the seconde step ,I input the line "primitive -i 1.jpg -o 1.jpg n-100",but show that "bash: primitive: command not found" ?How to run it ? I am a green hand ,thanks.