- Download this gist or copy it's content to a file. If you download it, the default file name will be
copy-to-clipboard-macos.m
- Compile the file using the command below:
gcc -Wall -g -O3 -ObjC -framework Foundation -framework AppKit -o imagecopy copy-to-clipboard-macos.m
- Move the built executable to a place on $PATH. You can easily move it to
/usr/local/bin
. Use the command below:
sudo mv imagecopy /usr/local/bin
imagecopy yourfile.png