control fan speed using Applescript (or terminal)
macOS does not support user control of the fan speed.

smcFanControl

The open source project smcFanControl claims to offer fan speed control. Be careful overriding Apple's fan behaviour; you risk damaging your computer.