This post was originally published on this site

Recently while I was trying to install a Docker related app called docker-squash on OSX El Capitan.

For those who are not familiar with the utility; docker squash is a nice utility that reduces the size of docker images by removing the layers

However when running the command

go get

I was getting the following error message :

Building docker-squash
export.go:19:2: cannot find package "" in any of:
/usr/lib/go/src/pkg/ (from $GOROOT)

Below I will show you how to build docker squash step by step (some steps can be omitted i.e. installing go if you already have installed)

Install go and set-up variables

brew install go
mkdir $HOME/.go
export GOPATH=$HOME/.go
export PATH=$PATH:$GOPATH/bin

Clone the docker squash repo

I’m not sure this is required but clone the repo under ~/.go/src/

git clone

Install glock and sync your repo

under the folder ~/.go/src/ run the following command

go get

Once the command finished sync your local repo with glock

glock sync

Install the units package

go get

Build docker squash

GOBIN=$(pwd) make

Install gnu-tar and added to the path

brew install gnu-tar

Move the executable to a bin folder

You should now have a docker-squash executable in your local repository; move the executable to a bin folder of your choice for example /usr/local/bin/

You should now be able to run docker-squash from your mac

Final thoughts and remarks

If you use docker-squash frequently you should change your .bashrc to do this automatically