Your Mac’s IP address tells you its unique network location, whether for troubleshooting connections, remote access, or configuring services. To find it quickly, use Terminal commands—no setup needed beyond opening the app. This guide covers both local (LAN) and public (external) IPs, with exact steps for macOS versions that differ slightly by system.
What You'll Need
- The built-in Terminal app (included with macOS)
- Your Mac’s network connection (Wi-Fi or Ethernet) active
- No additional software or permissions required
Step-by-Step
- Open Terminal
- Click the Launchpad icon (look for the magnifying glass shape) in your Dock.
- Search for Terminal and open it. If you don’t see it, press Cmd + Space, type "Terminal," then hit Enter.
- Check Local IP Address (LAN)
- Type the following command into Terminal and press Enter:
ifconfig - Look for the output with
inetunderen0(Wi-Fi) oren1(Ethernet). The IP will be in the format192.168.x.xor10.x.x.x. For example:en0: flags=8843... inet 192.168.1.100 netmask 0xff000000 broadcast 192.168.1.255 - If you see output with
127.0.0.1, your network is not properly configured—see the Troubleshooting section.
Note: macOS versions over 10.15 (Catalina) may hide the
ifconfigoutput by default. If you see no output, runsudo ifconfig(type your admin password when prompted). - Type the following command into Terminal and press Enter:
- Check Public IP Address (External)
- Type the following command and press Enter:
curl ifconfig.me - The response will display a public IP like
203.0.113.45. This is your Mac’s internet-facing address. - For a more detailed public IP lookup, use:
curl ipinfo.io(This returns additional info like location and ISP—but requires internet.)
- Type the following command and press Enter:
Common Mistakes
- No output from
ifconfigYour Mac may be offline, or the network service is disabled. Check your connection first, or run:sudo systemsetup -setnetworkservicesenabled Wi-Fi on(ReplaceWi-FiwithEthernetif needed.) - Commands not working in Catalina+
Older macOS versions show output by default. Newer versions hide it. Force it with:
sudo ifconfig(requires password) or edit/etc/hostconf.d/hosts.confto allow output. - Public IP changes after command
If you need stability, use a service like
ifconfig.coin your browser instead.
Tips
- Quick LAN check
Instead of
ifconfig, save this snippet to a file (nano ~/.local/bin/get_ip.sh) and run:chmod +x get_ip.sh && ./get_ip.shThis outputs the LAN IP directly to the terminal. - Monitor IP changes
To log IPs over time, use:
watch -n 1 ifconfig | grep inet(Press Ctrl+C to stop.) - Check multiple interfaces
Use
networksetup -listallhardwareportsto see all active network devices (Wi-Fi, Thunderbolt, etc.). - No admin password?
Run
sudo -sat the prompt, then type your password. Avoid entering it again.
Troubleshooting
If ifconfig returns empty or 127.0.0.1
This often means your Mac has no active network connection. Try:
- Restart your router Unplug the power for 30 seconds, then plug it back in. Wait 1 minute before testing.
- Restart your Mac Hold Cmd + Ctrl + Power to force restart. Wait 2 minutes for macOS to fully boot.
- Check network service
Run:
systemsetup -getnetworkservicesto see if Wi-Fi/Ethernet is disabled. Enable it with:systemsetup -setnetworkservicesenabled Wi-Fi on - Test with another device If your phone or computer shows a different IP, your Mac may be isolated. Contact your network admin or check for DHCP issues.
If curl fails
If you’re offline or behind a firewall, use the browser instead. Alternatively, try:
ping google.com
(A successful reply means your internet connection works.)
Frequently Asked Questions
1. How do I find my Mac’s IP if I’m not connected to Wi-Fi?
Use Ethernet instead. Plug your Mac into a wired network, then run ifconfig or sudo ifconfig to see the IP.
2. Why is my LAN IP different from my public IP?
A local IP (LAN) is your Mac’s address within your home network (e.g., 192.168.x.x), while a public IP is your Mac’s address on the internet (e.g., 203.0.113.45). They’re separate for security.
3. Can I use this on an older Mac (pre-Mac OS X Lion)?
Yes, but older Macs may not support curl. Use a browser for public IP checks, or install curl via macOS Homebrew (brew install curl).
4. How do I reset my Mac’s network settings?
Go to System Settings > Network > Advanced > Network Interface, then delete the active connection and reconnect. Warning: This removes saved Wi-Fi passwords.
5. Why is my IP address changing frequently?
This is normal if your ISP assigns dynamic IPs. For stability, use a VPN or static IP service. Check with route -n to see if your Mac is routing properly.
6. How do I find my Mac’s IP while connected to a VPN?
VPNs change your public IP, but the LAN IP inside your home network (e.g., 10.x.x.x) won’t change. Use ifconfig and look for the VPN tunnel interface (e.g., en0 before en1).
Jump to the next step (public IP check).