# How do I find MAC address?

**URL:** https://discourse.julialang.org/t/how-do-i-find-mac-address/96653
**Category:** New to Julia
**Created:** [March 27, 2023, 11:19am UTC](https://discourse.julialang.org/t/how-do-i-find-mac-address/96653 "2023-03-27T11:19:48Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![drruvw](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/drruvw/32/48067_2.png) [@drruvw](https://discourse.julialang.org/u/drruvw)
#### Post date: [March 27, 2023, 11:19am UTC](https://discourse.julialang.org/t/how-do-i-find-mac-address/96653/1 "2023-03-27T11:19:48Z")

</div>

How do I get MAC address using Julia please?

---

<div class="post-metadata">

### Author: ![bernhard](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bernhard/32/2619_2.png) [@bernhard](https://discourse.julialang.org/u/bernhard)
#### Post date: [March 27, 2023, 12:27pm UTC](https://discourse.julialang.org/t/how-do-i-find-mac-address/96653/2 "2023-03-27T12:27:35Z")

</div>

Your question does not seem julia specific.  
Also, the answer may depend on the operation system.  
Are you trying to find the MAC address of the machine executing the Juia code?

on Windows, the following may help

```julia
read(`ipconfig /all`,String)
y = read(`ipconfig /all`,String)
y2 = split(y,"\r\n")
filter(x->occursin("ysic",x),y2)

julia> filter(x->occursin("ysic",x),y2)
7-element Vector{SubString{String}}:
 " Physical Address. . . . . . . . . : 00-50-B6-F0-76-45"
 " Physical Address. . . . . . . . . : 3C-E9-F7-5B-9F-0F"
 " Physical Address. . . . . . . . . : 3C-E9-F7-5B-9F-10"
 " Physical Address. . . . . . . . . : 3E-E9-F7-5B-9F-0F"
 " Physical Address. . . . . . . . . : 00-00-00-00-00-00-00-E0"
 " Physical Address. . . . . . . . . : 8C-9D-8A-53-59-45"
 " Physical Address. . . . . . . . . : 00-15-5D-83-D4-E6"

```

---

<div class="post-metadata">

### Author: ![drruvw](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/drruvw/32/48067_2.png) [@drruvw](https://discourse.julialang.org/u/drruvw)
#### Post date: [March 27, 2023, 3:23pm UTC](https://discourse.julialang.org/t/how-do-i-find-mac-address/96653/3 "2023-03-27T15:23:35Z")

</div>

Thanks. I was wondering if we have something similar to getipaddr() irrespective of the underlying OS (using any package if not std lib)

---

<div class="post-metadata">

### Author: ![bernhard](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bernhard/32/2619_2.png) [@bernhard](https://discourse.julialang.org/u/bernhard)
#### Post date: [March 27, 2023, 3:31pm UTC](https://discourse.julialang.org/t/how-do-i-find-mac-address/96653/4 "2023-03-27T15:31:27Z")

</div>

there is this  
[https://docs.julialang.org/en/v1/stdlib/Sockets/#Sockets.getipaddr](https://docs.julialang.org/en/v1/stdlib/Sockets/#Sockets.getipaddr)  
but I am not sure if it yields the MAC address

---

<div class="post-metadata">

### Author: ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)
#### Post date: [March 27, 2023, 3:55pm UTC](https://discourse.julialang.org/t/how-do-i-find-mac-address/96653/5 "2023-03-27T15:55:54Z")

</div>

In Python, there is a library called [`getmac`](https://github.com/GhostofGoes/getmac); it looks like something that could be straightforwardly ported to Julia.

(Or you could call it directly from Julia with PyCall or PythonCall, but then you have to deal with installing Python stuff.)
