This repository contains copies of Alec Jacobson’s impbcopy and impbpaste programs for copying and pasting images from the command line on macOS. You can read more about them in his original blog post.
I’ve created a (terribly) simple makefile. You can use it by doing the following:
make install
Of course, you’ll probably want to read it beforehand.
As Alec mentioned in his original post, you may want to use pngpaste instead because it has more features than impbpaste.