Fix internet sharing on OS X Mavericks

It seems that OS X Mavericks has issues resuming internet sharing over WiFi when waking up from sleep. This is especially annoying, as only restarting seems to “fix” this issue. After searching on Google for a while, I stumbled upon this. The forum post suggests to kill bootps to free the port opened by internet sharing, even though it is not running anymore. For me this seems like a reliable solution, even though I wish Apple would fix it.

Running the following script will allow restarting internet sharing:

sudo lsof -i udp:67 | grep bootpd |awk ‘{ print $2 }’| while read pid; do echo killing $pid; sudo kill -9 $pid&&echo “successfull…”; done