If you encounter issues such as port conflicts when running a DHCP server on macOS, you might need to disable the built-in DHCP service. This guide walks you through the process of disabling DHCP using the bootpd.plist
configuration file.
An example error message might look like this:
Error: control/dhcp/set_config
enabling dhcp: starting dhcp server: dhcpv4:
creating ipv4 udp connection: cannot bind to port 67: address already in use
This indicates that another process is already using port 67, which is reserved for DHCP.
Open Terminal and edit the bootpd.plist
file located in /etc/
:
sudo nano /etc/bootpd.plist
Disable DHCP:
Locate the <key>dhcp_enabled</key>
section and set its value to an empty <array>
:
<key>dhcp_enabled</key>
<array/>
Remove or Disable Subnets:
If there is a <key>Subnets</key>
section, comment it out or remove the <dict>
entirely.
Disable BOOTP:
Ensure the following key is set to false
:
<key>bootp_enabled</key>
<false/>
Press Ctrl + O
to save changes, then Ctrl + X
to exit the editor.
Restart the bootpd
service to apply the changes:
sudo launchctl stop com.apple.bootpd
sudo launchctl unload /System/Library/LaunchDaemons/bootps.plist
This stops the DHCP service from running.
Check if port 67 is still in use:
sudo lsof -i :67
If no output appears, the DHCP service has been successfully disabled.
sudo lsof -i :67
sudo kill -9 <PID>
If needed, restore the original configuration:
sudo cp /etc/bootpd.plist /etc/bootpd.plist.bak
sudo defaults write /etc/bootpd.plist ""
By following this guide, you can successfully disable DHCP on macOS, resolve port conflicts, and ensure your network services run smoothly.