Is there a way to view the list of IP addresses that were assigned to my iMac over a period of time (e.g., the last 30 days)? I'd like to get this information from the iMac itself if possible.

  • Where are you looking to get this information from? Your local mac? or your dhcp server, taking you have one available? – tron_jones Oct 9 '14 at 13:34
  • @tron_jones Local MAC. – o-0 Oct 9 '14 at 14:20

By default your mac won't keep a history of DHCP address and times. I put together a launchd and script that should do the trick if you must have client side records for DHCP times and ips.

launcd plist called com.local.DHCP-History.plist that needs to be placed in /Library/LaunchDaemons/

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">

Here is the script it will run, I put it in /usr/bin/ but you can put where you want just make sure to change the environment path in the launch daemon. You will have to create a folder called DHCP_History in /private/var/log/ to create the log files in.


# tron_jones 09-10-14

# Create a log for DHCP changes and put in new folder with date
mkdir /private/var/log/DHCP_History/"$dateVar" 
for i in `ls /private/var/db/dhcpclient/leases/`
    cp "${path}${i}" "${logPath}${dateVar}"/DHCP_ChangeHistory_"${i}".log

Make sure that the script is executable and owned by root:wheel. Run these commands to do that:

sudo chmod +x /usr/bin/DHCP_History.sh

sudo chown root:wheel /usr/bin/DHCP_History.sh

Now every time DHCP gets renewed or changes it will create a file called DHCP_ChangeHistory.log inside /private/var/log/DHCP_History/thedate/

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .