This is just a note to myself so I don’t forget. The command is:

sysctl -n machdep.cpu.brand_string

Usually prints something like:

Intel(R) Core(TM) i3-6100 CPU @ 3.40GHz

Or something similar. (The string above is fake!)