brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: renew the DHCP lease on your Mac after a router change

macOS
~/tips/tip-macos-renew-dhcp-lease

System Settings > Network > Wi-Fi > Details > TCP/IP > Renew DHCP Lease

Asks the DHCP server for a fresh address and settings without switching Wi-Fi off and on.

After adding a DHCP reservation or changing the DNS server the router hands out, I want my Mac to pick up the new settings right away, instead of whenever the old lease runs out. Switching Wi-Fi off and on works, but macOS has a button for exactly this.

System Settings > Network > Wi-Fi > Details > TCP/IP > Renew DHCP Lease

Click the service you’re on (Wi-Fi or Ethernet), then Details, then TCP/IP. The Renew DHCP Lease button sits at the bottom; click it, then OK. Apple only shows it when the service uses DHCP, so on a manually configured connection it isn’t there.

From the Terminal you get the same result with ipconfig:

sudo ipconfig set en0 DHCP

This removes the current IPv4 configuration on en0 and starts a fresh DHCP one, so the Mac asks the server again for its address, subnet mask, router and DNS. I’d reach for it right after giving the MacBook a fixed address in the router: run it, then look at the IP address in the same Details pane to see whether the reservation took.

There’s a catch in Apple’s man page. ipconfig set creates a temporary service that only lasts until the next network configuration change, and Apple describes the tool as meant for testing and debugging. For a one-off renew that’s what you want. To switch a connection between DHCP and a manual address for good, use Configure IPv4 in the TCP/IP pane instead. The interface also loses its address for a moment while it renews, so don’t run this over an SSH session to that same Mac.

Further reading: Renew your IP address from the DHCP server on Mac (Apple), ipconfig man page (SS64, macOS)

More macOS tips System Settings > Accessibility > Hover Text > When using the pointer A Smart Folder in Notes collects notes by tag, checklist or date Type # in a Mac note to tag it, then filter by tag in the sidebar tmutil isexcluded ~/Projects/app/node_modules Crop an image in Preview by dragging a frame and clicking Crop All macOS tips (99) All topics

Link