Jump to content

Change Mac Address during startup


timerace
 Share

3 posts in this topic

Recommended Posts

Mac OS X : How to Set the MAc Address During Startup

 

Follow these steps to create a script that sets the MAC Address each time the computer restarts:

 

1. Open Terminal (/Applications/Utilities/).

2. Type: cd /Library

3. Press Return.

4. Type: mkdir StartupItems

5. Press Return. (If you encounter an error, continue to step 6.)

6. Type: cd StartupItems

7. Press Return.

8. Type: mkdir MACADD

9. Press Return.

10. Type: cd MACADD

11. Press Return.

12. Type: pico MACADD

13. Press Return.

14. In the pico editor, paste in the following text.

 

Begin copying below this line.

--------------------------------------------------------------------------------

 

#!/bin/sh

 

. /etc/rc.common

 

##

# Configure a network interface MAC Address setting

##

#

# This script will set the MAC Address setting for the specified interface(s)

#

# The name of the interface (ex. en0) must be edited to match the interface

# to which the MACADD setting should be applied

#

##

 

StartService ()

{

ConsoleMessage "Configuring MACADD"

 

### uncomment lines and change the value following 'MACADD' as appropriate mac address

 

if [ "${MACADD:=-NO-}" = "-YES-" ]; then

 

# /sbin/ifconfig en0 lladdr xx:xx:xx:xx:xx:xx

# /sbin/ifconfig en1 lladdr xx:xx:xx:xx:xx:xx

 

fi

 

}

 

StopService ()

{

return 0

}

 

RestartService ()

{

return 0

}

 

RunService "$1"

 

--------------------------------------------------------------------------------

 

End copying above this line.

 

15. Uncomment the /sbin/ifconfig line(s) to set the MACADD for a particular interface.

 

 

Note: Removing the number sign (#) from the beginning of a line uncomments it. Typically, en0 is the interface name for the Built-in Ethernet port and en1 is interface name for the AirPort Card. This is not always the case, though. To confirm that a network port is associated with a particular interface name, open the Network Utility (/Applications/Utilities/), and click the Info tab.

 

 

16. When you have finished customizing the file, save it (press Control-O), press Return, and exit pico (press Control-X).

 

17. Type: chmod 755 MACADD

 

18. Press Return.

 

19. Type: pico StartupParameters.plist

 

20. Press Return.

 

21. In the pico editor paste in the following text.

 

 

Begin copying below this line.

 

 

--------------------------------------------------------------------------------

 

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">

<plist version="1.0">

<dict>

<key>Description</key>

<string>Can set MACADD</string>

<key>OrderPreference</key>

<string>None</string>

<key>Provides</key>

<array>

<string>MACADD</string>

</array>

<key>Requires</key>

<array>

<string>Network Configuration</string>

</array>

</dict>

</plist>

 

--------------------------------------------------------------------------------

 

End copying above this line.

 

22. When you have finished customizing the file, save it (Control-O), press Return, and exit pico (Control-X).

23. Type: chmod 755 StartupParameters.plist

24. Press Return.

25. Type: sudo pico /etc/hostconfig

26. When prompted, enter your password.

27. Press Return.

28. In the pico editor, add this line at the bottom:

 

MACADD=-YES-

 

29. Save it (Control-O), press Return, and exit pico (Control-X).

 

When you restart the computer, MACADD is set for the interface that you specified.

 

Notes

 

 

1. The MACADD will be reset after changing a Location, waking the computer from sleep, or changing the state of the network interface. To use the script again without having to restart, enter the following command:

 

sudo SystemStarter start MACADD

 

2. If you experience any issues or wish to not set MACADD during startup, you can turn off the new script by changing the MACADD line in /etc/hostconfig to:

 

MACADD=-NO-

Link to comment
Share on other sites

  • 10 months later...

hi, i followed your script but my wifi adapter is still inactive, is this a driver issue? or i am doing something wrong? i copied and pasted your script and changed the xx:xx:xx:xx to my mac address and taken the comment on the line that i want to take effect, thanks for the tutorial and help!

Link to comment
Share on other sites

  • 4 months later...
hi, i followed your script but my wifi adapter is still inactive, is this a driver issue? or i am doing something wrong? i copied and pasted your script and changed the xx:xx:xx:xx to my mac address and taken the comment on the line that i want to take effect, thanks for the tutorial and help!

 

The reason why it is inactive is because there currently is no driver installed on your system for your wifi card. Go search around on google and the forums for a driver for your card. I use kext helper to install of my kext files as it does all the command line stuff for you. You can get it at this website. Hope this helps!

 

Amorstus

Link to comment
Share on other sites

 Share

×
×
  • Create New...