how to get mac cpu temp

Shell
To get CPU temperature:
sudo powermetrics|grep -i "CPU die temperature"
To get GPU temperature:
sudo powermetrics|grep -i "GPU die temperature"
Source

Also in Shell: