1. Install the command-line tools on macOS by running:


sudo xcode-select --install


2. Download the PiShrink script by running:

curl -LO https://github.com/lisanet/PiShrink-macOS/archive/master.zip
unzip master
cd PiShrink-macOS-master
make
sudo make install


3. Shrink the image by running:

pishrink name_of_image_file.img