Yes there is a way!

[Intel Power Gadget][1] has a rather obscure `PowerLog` command line utility. This lets you access all the data in the GUI, but doesn't require you to write your own code. After installing Intel Power Gadget, the tool is at `/Applications/Intel Power Gadget/PowerLog`.

It seems intended to generate csv files for later analysis, `PowerLog.csv` by default, but with the `-verbose` flag you can get the data directly in the shell.

So to get your current frequency, this should work:
```sh
$ "/Applications/Intel Power Gadget/PowerLog" -duration 1 -verbose  | grep "IA frequency:"  | head -1
IA frequency: 1655 (1200..2600) MHz, request: 1650 (1300..2600) MHz
```

But also, as others have said, looking for a single frequency is over simplifying things.  If you look at the full output from one sample you can see each thread's frequency

```sh
$ /Applications/Intel\ Power\ Gadget/PowerLog -resolution 1000 -duration 1 -verbose
Num Packages: 1
Using Package: 0
Num Cores: 16
GT Available? 1
IA Energy Available? 1
DRAM Energy Available? 1
Max Temperature: 100 degrees Celcius
IA Base Frequency: 2400 MHz
IA Max Frequency: 5000 MHz
TDP: 45.00 W
package temperature: 60.00 degrees Celsius
--------------------------
GT frequency: 0 MHz
GT frequency request: 0 MHz
package temperature: 57.00 degrees Celsius
IA temperature: 56.69 (55..59) degrees Celsius
IA metrics per-core:
	core 0 request: 2091 MHz temperature: 57 degrees Celcius
	core 1 request: 1767 MHz temperature: 58 degrees Celcius
	core 2 request: 1856 MHz temperature: 57 degrees Celcius
	core 3 request: 2000 MHz temperature: 57 degrees Celcius
	core 4 request: 1969 MHz temperature: 56 degrees Celcius
	core 5 request: 2000 MHz temperature: 56 degrees Celcius
	core 6 request: 1976 MHz temperature: 55 degrees Celcius
	core 7
	core 8 request: 1825 MHz temperature: 55 degrees Celcius
	core 9
	core 10 request: 1650 MHz temperature: 56 degrees Celcius
	core 11
	core 12 request: 1825 MHz temperature: 56 degrees Celcius
	core 13 request: 2000 MHz temperature: 56 degrees Celcius
	core 14 request: 1650 MHz temperature: 56 degrees Celcius
	core 15
--------------------------
IA frequency: 2070 (1200..3600) MHz, request: 2266 (1300..5000) MHz
GT frequency: 0 MHz
GT frequency request: 0 MHz
package power: 5.46 Watts, energy: 5.47 Joules
IA power: 2.84 Watts, energy: 2.85 Joules
DRAM power: 1.34 Watts, energy: 1.34 Joules
package temperature: 57.00 degrees Celsius
IA temperature: 56.74 (54..60) degrees Celsius
IA utilization: 0.78 %
IA metrics per-core:
	core 0 frequency: 1836 MHz request: 1915 MHz temperature: 57 degrees Celcius utilization: 4.56 %
	core 1 frequency: 1805 MHz request: 1650 MHz temperature: 57 degrees Celcius utilization: 0.04 %
	core 2 frequency: 2380 MHz request: 2763 MHz temperature: 57 degrees Celcius utilization: 4.76 %
	core 3 frequency: 1930 MHz request: 1300 MHz temperature: 57 degrees Celcius utilization: 0.02 %
	core 4 frequency: 2036 MHz request: 2127 MHz temperature: 55 degrees Celcius utilization: 1.24 %
	core 5 frequency: 1902 MHz request: 2550 MHz temperature: 55 degrees Celcius utilization: 0.04 %
	core 6 frequency: 1951 MHz request: 2075 MHz temperature: 55 degrees Celcius utilization: 0.84 %
	core 7 frequency: 1691 MHz request: 2000 MHz temperature: 55 degrees Celcius utilization: 0.02 %
	core 8 frequency: 1891 MHz request: 1991 MHz temperature: 55 degrees Celcius utilization: 0.46 %
	core 9
	core 10 frequency: 1592 MHz request: 1620 MHz temperature: 55 degrees Celcius utilization: 0.21 %
	core 11
	core 12 frequency: 1859 MHz request: 1860 MHz temperature: 56 degrees Celcius utilization: 0.11 %
	core 13 frequency: 2214 MHz request: 1300 MHz temperature: 56 degrees Celcius utilization: 0.02 %
	core 14 frequency: 1684 MHz request: 1580 MHz temperature: 55 degrees Celcius utilization: 0.11 %
	core 15
Done
```


  [1]: https://software.intel.com/content/www/us/en/develop/articles/intel-power-gadget.html