This tutorial has been linked on the forum previously Introduction to command line · HonKit.
From a clue you may find some inspiration here [HOW-TO] Flash /e/-OS on Fairphone 3 using Debian based GNU/Linux, keep an eye out for any slight deviations using Mac.