How can I find my public and privates IP addresses in macOS from command line?
Find your public IP in macOS
Public IP addresses are your unique “public” identifiers and anyone from the world can reach your computer using your public IP. For example, every website in the world has a unique public IP address.
You can call the following services to get the public IP address for your computer:
curl ifconfig.me
curl ipinfo.io/ip
curl checkip.dyndns.org
(Note: Returns HTML response)
Find your private IP in macOS
Private IP addresses are the ones your get from our Wifi router. They are in the range 192.168.., 172.16.. to 172.31.., or 10...*.
You can call the following services to get the private IP address for your computer:
ipconfig getifaddr en0
oripconfig getifaddr en1
ifconfig -a