Renew DHCP from the Terminal
My MacBook Pro’s internet has been acting up every time it wakes from sleep. It loses the network configuration and I get the WiFi with exclamation point icon.
Without time for real debugging, I noticed that clicking Renew DHCP Lease under System Preferences › Network › Advanced… › TCP/IP
would fix the issue. However, getting there after each wake-up was very ungeeky of me.
A quick search turned up a way to do it from the terminal, then just open up ~/.bash_profile
, and add:
alias dhcp-renew='echo "add State:/Network/Interface/en0/RefreshConfiguration temporary" | sudo scutil'
Now, I do a ⌘+tab for the always open terminal window, type in dhcp-renew
and password — if I have not authenticated in a while — and boom, all is right with the internet.
I’m attributing this to a Mavericks bug[1], and hope that a 10.9.1 squashes this, but in the meantime it’s a quick fix that can be useful in other situations.