Set IP Address from the Mac Command Line
![]()
The quickest way to set your IP address from the command line is to issue the following command in the Terminal:
sudo ipconfig set en1 DHCP
This will renew your DHCP lease and you will be issued a new IP address from the DHCP server. FYI: en1 is generally wireless/airport, en0 is generally ethernet.
You can check that the IP is set by getting your current IP address from the command line with:
ipconfig getifaddr en1
Doing this before and after will insure you have a new IP.
You can specify an IP address to set via the command line with the following:
sudo ipconfig set en1 INFORM 192.168.0.150
You can also get a new IP address from a DHCP server by bringing down the interface and starting it back up again:
sudo ifconfig en1 down ; sudo ifconfig en1 up
Note: for whatever reason, when you are setting the IP address manually via the command line the Mac OS X Network Preferences doesn’t necessarily catch up to the changes. Do not be surprised if the Network preference pane is telling you that you “Airport does not have an IP address and cannot connect to the Internet.” when in fact, you do have one and you are online. You can verify that you are connected to the LAN or internet by using the ping command.

“sudo ipconfig set en1 INFORM 192.168.0.150″ – is this then permanent, i.e. the equivalent of manually setting it in the Network pref pane?
Hi,
ipconfig – it’s a command from the windows, or something I don’t know. Please correct me if I’m wrong
ipconfig is a mac os x command-line utility for manipulating DHCP leases, including the DHCP with manual address (which is the INFORM option).
/usr/sbin/networksetup will do all this and more. Think of networksetup as a command-line equal to Network Preferences.
[...] a pain depending on your access to the router itself. If resetting the router is a no go, you can renew your DHCP lease in Mac OS X either through the command line (as the linked article shows) or through the Network settings [...]
[...] The other command line option is to use: ipconfig getifaddr en1 which reports back only your en1 (usually wireless) IP address. You can change this to en0 for wired/ethernet too. I have heard ipconfig is not supported in all versions of Mac OS X so I did not recommend this as the first choice. However, using ipconfig you can also set your IP address from the command line. [...]
According to the Mac OS X man page, Using
ipconfigwithINFORMrequires the use of an IP address and an explicit subnet mask. However, sadly, I’ve found that INFORM doesn’t work as advertised.Have you actually tried this out and found that it worked? Using
ipconfig…INFORM, have you ever actually set an IP address statically and yet actually received DHCP option information, like DNS settings, that stuck?In my experience, at least on Mac OS X 10.6.5, using
INFORM works exactly like settingMANUAL and doesn't actually use DHCP to set any of the other networking options.
Also, what's with the "Renew DHCP Lease" button disappearing in the System Preferences Networking preference pane GUI when "Use DHCP with manual address" is selected? Grr….
Crud. Pardon my formatting error.
I get this message when I try to do use the “sudo ipconfig set en1 INFORM 192.168.0.104″ command:
WARNING: Improper use of the sudo command could lead to data loss
or the deletion of important system files. Please double-check your
typing when using sudo. Type “man sudo” for more information.
To proceed, enter your password, or type Ctrl-C to abort.
Yes that is a message telling you that the sudo command is super user privileges and that it needs your password.
i get this problem with my MAC.. should i do that ..?? Another device on the network is using your computer IP address