Get your local IP in macOS

Use ifconfig (equivalent to ipconfig in Windows) to get your Mac's interface configuration.

Normally, local IPs have a 192.168.X.X pattern, so you can combine ifconfig and grep to filter strings starting with 192.

Example:

terminal
ifconfig | grep 192

The vertical bar (|) is a pipe. It takes the output from the first command as the input from the second one.

Hi, I'm Erik, an engineer from Barcelona. If you like the post or have any comments, say hi.