How to create link aggregates (bonded interfaces) in shell?

See man networkSetup.

Execute the following to bond interfaces en2 & en3:

sudo networkSetup createBond bond0 en2 en3

It is also useful to be able to get all active interfaces (with or without IP, simply labeled as active since you might have a primary interface + the interfaces you want to bond):

for i in $(ifconfig -lu); do if ifconfig $i | grep -q "status: active" ; then echo $i; fi; done