From time to time you may want to quickly copy a raspberry pi image from one system to another….but only have a smaller SD card. Or you started your project as a tryout on a crazy 64GB sd card, and realize later that 8GB would be way enough. So what you want to do, is resize the source image to the smallest size possible, flash it to the new smaller SD card, and expand it again to its new maximum on the new SD card. And so far that process can be very long and painful….but luckily there is a very handy script for that, called PiShrink. I am using the mac version, but there is also a linux version.
Source: Quickly resize and shrink Raspberry Pi SD card image on MacOS – Florian Müller
Similar article that expands on the one linked above: Flash larger SD card image onto smaller card on Mac for your Raspberry Pi – Medium/Practical coding