I am writing a script that needs to know what the MAC address of the host computer is.
Does anyone know how to do this?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I don’t think there is any Ruby built-in function to retrieve that address; you’ll likely have to make a system call to list the value (e.g.
ifconfigon UNIX,ipconfig /allon Win32) and parse the output as necessary.Something like this (untested pseudocode):