How to get iPhone ECID from MacOS terminal
You simply run this command:

ideviceinfo | grep UniqueChipID

The "unique chip ID" is what you know as the ECID.

Note: iTunes shows the ECID as a hexadecimal value, while ideviceinfo shows it as a decimal value.