# How do I find my local IP on a Mac?

**URL:** <https://boards.straightdope.com/t/how-do-i-find-my-local-ip-on-a-mac/388362>\
**Category:** Factual Questions\
**Created:** [January 17, 2007, 8:00pm UTC](https://boards.straightdope.com/t/how-do-i-find-my-local-ip-on-a-mac/388362 "2007-01-17T20:00:20Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![pulykamell](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/pulykamell/32/3166_2.png) [@pulykamell](https://boards.straightdope.com/u/pulykamell)\
**Post date:** [January 17, 2007, 8:00pm UTC](https://boards.straightdope.com/t/how-do-i-find-my-local-ip-on-a-mac/388362/1 "2007-01-17T20:00:20Z")

</div>

With Windows boxes, I type “ipconfig” to figure out what my local IP address is (in the form of 192.168.1.xxx). What would I do on a Mac or through the terminal (Unix)?

---

<div class="post-metadata">

**Author:** ![friedo](https://avatars.discourse-cdn.com/v4/letter/f/8edcca/32.png) [@friedo](https://boards.straightdope.com/u/friedo)\
**Post date:** [January 17, 2007, 8:01pm UTC](https://boards.straightdope.com/t/how-do-i-find-my-local-ip-on-a-mac/388362/2 "2007-01-17T20:01:59Z")

</div>

In the terminal, type ifconfig. The first Ethernet device is called en0 and it’s probably the one you want.

---

<div class="post-metadata">

**Author:** ![Balthisar](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/balthisar/32/2825_2.png) [@Balthisar](https://boards.straightdope.com/u/Balthisar)\
**Post date:** [January 17, 2007, 8:02pm UTC](https://boards.straightdope.com/t/how-do-i-find-my-local-ip-on-a-mac/388362/3 "2007-01-17T20:02:51Z")

</div>

Open up your networking control panel. It’ll be right there. Or in terminal use ifconfig with no parameters.

---

<div class="post-metadata">

**Author:** ![pulykamell](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/pulykamell/32/3166_2.png) [@pulykamell](https://boards.straightdope.com/u/pulykamell)\
**Post date:** [January 17, 2007, 8:14pm UTC](https://boards.straightdope.com/t/how-do-i-find-my-local-ip-on-a-mac/388362/4 "2007-01-17T20:14:11Z")

</div>

[QUOTE=Balthisar]  
Open up your networking control panel. It’ll be right there. Or in terminal use ifconfig with no parameters.  
[/QUOTE]

Thanks much for both solutions!

---

<div class="post-metadata">

**Author:** ![TimeWinder](https://avatars.discourse-cdn.com/v4/letter/t/bcef8e/32.png) [@TimeWinder](https://boards.straightdope.com/u/TimeWinder)\
**Post date:** [January 17, 2007, 8:41pm UTC](https://boards.straightdope.com/t/how-do-i-find-my-local-ip-on-a-mac/388362/5 "2007-01-17T20:41:35Z")

</div>

And realize that the concept of “my IP address” is pretty dated at this point. It’s very likely that you have multiples, even on a simple home machine. Parallels, for example, installs a “ghost” network adaptor with it’s own IP, Bluetooth may have one depending on how you’re set up, and of course there are the simple cases of having more than one network adaptor enabled.

---

<div class="post-metadata">

**Author:** ![pulykamell](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/pulykamell/32/3166_2.png) [@pulykamell](https://boards.straightdope.com/u/pulykamell)\
**Post date:** [January 17, 2007, 9:11pm UTC](https://boards.straightdope.com/t/how-do-i-find-my-local-ip-on-a-mac/388362/6 "2007-01-17T21:11:01Z")

</div>

[QUOTE=TimeWinder]  
And realize that the concept of “my IP address” is pretty dated at this point. It’s very likely that you have multiples, even on a simple home machine. Parallels, for example, installs a “ghost” network adaptor with it’s own IP, Bluetooth may have one depending on how you’re set up, and of course there are the simple cases of having more than one network adaptor enabled.  
[/QUOTE]

I needed to know it for setting up port forwarding. It’s still applicable there, right?

---

<div class="post-metadata">

**Author:** ![TimeWinder](https://avatars.discourse-cdn.com/v4/letter/t/bcef8e/32.png) [@TimeWinder](https://boards.straightdope.com/u/TimeWinder)\
**Post date:** [January 17, 2007, 9:33pm UTC](https://boards.straightdope.com/t/how-do-i-find-my-local-ip-on-a-mac/388362/7 "2007-01-17T21:33:17Z")

</div>

[QUOTE=pulykamell]  
I needed to know it for setting up port forwarding. It’s still applicable there, right?  
[/QUOTE]

Yes, you just need to get (a/the) right one for whatever purpose you’re using. In your case, one of the ones associated with the primary network adaptor.

But if your machines are set up to get addresses dynamically, your port forwarding will only work for as long as the machines have the same address (which may change at shutdown and other times). If you want (extended time) port forwarding, you probably want to give your computers static addresses – in which case it’s easy to look up the IP address in the control panel where you set it, rather than going to the command line.

---

<div class="post-metadata">

**Author:** ![chambraigne](https://avatars.discourse-cdn.com/v4/letter/c/ad7895/32.png) [@chambraigne](https://boards.straightdope.com/u/chambraigne)\
**Post date:** [January 17, 2007, 9:42pm UTC](https://boards.straightdope.com/t/how-do-i-find-my-local-ip-on-a-mac/388362/8 "2007-01-17T21:42:30Z")

</div>

This is probably more than you need, and if so, just disregard it. But recently I needed to write an AppleScript that would pop up a message with their IP address without them even having to know what System Preferences are.

In any case, I found that running the command “ipconfig getifaddr en0” was the easiest to handle–it simply returns the IP address for the default ethernet device, without all the other confusing things to sift through. It sure made it easier to write a quick AppleScript–no parsing necessary.

---

<div class="post-metadata">

**Author:** ![Cleophus](https://avatars.discourse-cdn.com/v4/letter/c/a88e57/32.png) [@Cleophus](https://boards.straightdope.com/u/Cleophus)\
**Post date:** [January 17, 2007, 10:37pm UTC](https://boards.straightdope.com/t/how-do-i-find-my-local-ip-on-a-mac/388362/9 "2007-01-17T22:37:21Z")

</div>

“Default internet device” may be somewhat confusing. en0 is the built-in Ethernet. If your machine has multiple built-in Ethernet ports, then they will be numbered en1 and so on. The AirPort card, if present, is numbered after the built-in Ethernet devices. Since most Macs have one Ethernet port and AirPort capability, en0 will be the Ethernet device and en1 will be the AirPort card. You may see a fw0, that’s for networking over FireWire; lo0, that’s the loopback interface; and gif0 and stf0, used for IPv6 tunneling. If a dial-up link is active, there will be a ppp0 interface.

---

<div class="post-metadata">

**Author:** ![Balthisar](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/balthisar/32/2825_2.png) [@Balthisar](https://boards.straightdope.com/u/Balthisar)\
**Post date:** [January 18, 2007, 1:28pm UTC](https://boards.straightdope.com/t/how-do-i-find-my-local-ip-on-a-mac/388362/10 "2007-01-18T13:28:04Z")

</div>

[QUOTE=Cleophus]  
“Default internet device” may be somewhat confusing. en0 is the built-in Ethernet. If your machine has multiple built-in Ethernet ports, then they will be numbered en1 and so on. The AirPort card, if present, is numbered after the built-in Ethernet devices. Since most Macs have one Ethernet port and AirPort capability, en0 will be the Ethernet device and en1 will be the AirPort card. You may see a fw0, that’s for networking over FireWire; lo0, that’s the loopback interface; and gif0 and stf0, used for IPv6 tunneling. If a dial-up link is active, there will be a ppp0 interface.  
[/QUOTE]

If you look at the network control panel, it will tell you which via device you are connected to the internet, if in fact your are. Not sure how to glom that programatically, though.
