The spice directive is
.ac dec 100 1 1G
(will do 100 points in each freq decade, from 1Hz to 1GigaHertz, for example).
You have to have a Voltage source with AC=1V connected at the input.
Observe the output node of choice, you should get something like Bode diagram with gain in dB and phase in degree.
Note: for an AC analysis the LTspice (for example) has to create a small signal model first, based on DC analysis (done in background).
When your CMOS inverter does not possess a model which includes the DC components (ie. a complete wiring with nmos/pmos transistors, Gnd, and Vcc) it may fail with an error.
See below: