If you ever need to know the history of specific Macs that have been assigned local IP addresses, you can find this potentially useful network information from the command line.This trick will report all local IPs that were used by the Mac and, very useful, will also suggest the specific date and time that the given IP address was assigned to the Mac.Yes, this data covers networks and applies even if it is no longer the machine’s active IP address.
If you’re wondering why this might be useful, IP address history can be invaluable for network troubleshooting purposes such as annoying same IP error, system and network administration, digital forensics, and probably other tasks.
Get list of local IP addresses assigned by Mac
The following command will get a complete list of all locally assigned IP addresses on a given Mac:
cat /var/log/wifi.log |grep "Local IP" |less
An example of such output would look something like this, keep in mind that the output can be very long depending on the size of the wifi.log file and the age of the Mac, so the results are passed in less or more for easier reading.If you want the entire history to be displayed on the command line, leave the last vertical bar “|less”:
Sat Jul4 15:23:00.296
Sat Jul4 16:24:05.694
Sat Jul4 16:45:32.476
Sat Jul4 20:22:31.770
Sun Jul5 10:38:38.518
Sun Jul5 20:21:48.599
Mon Jul6 02:28:09.715
Mon Jul6 02:43:17.257
Mon Jul6 04:56:42.701
Mon Jul6 05:11:46.536
Mon Jul6 16:59:42.216
Mon Jul6 19:11:29.563
Mon Jul6 19:59:55.667
Mon Jul6 22:11:50.543
Mon Jul6 22:26:56.589
Tue Jul7 00:38:51.855
Tue Jul7 00:53:55.393
Tue Jul7 21:04:15.704
Tue Jul7 22:05:00.573
Tue Jul7 22:06:15.692
Tue Jul7 23:07:00.554
Tue Jul7 23:08:15.577
Wed Jul8 00:27:41.617
Wed Jul8 02:16:26.556
Wed Jul8 02:17:41.587
Wed Jul8 04:06:26.555
Wed Jul8 04:07:41.605
Wed Jul8 05:56:26.566
Wed Jul8 05:57:40.226
Wed Jul8 07:01:33.566
Wed Jul8 08:17:18.563
Wed Jul8 10:59:16.586
Wed Jul8 11:34:45.866
Wed Jul8 20:52:50.550
Wed Jul8 22:19:41.216
Wed Jul8 22:22:06.838
Wed Jul8 22:24:44.172
Wed Jul8 22:27:09.892
Wed Jul8 22:29:37.016
Wed Jul8 22:31:21.625
Wed Jul8 23:31:32.612
Wed Jul8 23:33:58.271
Wed Jul8 23:36:24.034
Wed Jul8 23:38:08.778
Thu Jul9 01:22:14.939
Thu Jul9 01:24:40.627
Sun Jul 12 00:51:33.181
Sun Jul 12 02:40:18.606
Sun Jul 12 04:11:02.478
Sun Jul 12 05:59:47.615
Sun Jul 12 07:00:48.608
Sun Jul 12 08:01:33.610
Sun Jul 12 09:02:18.613
Sun Jul 12 09:18:30.315
Sun Jul 12 10:41:23.334
Sun Jul 12 11:42:08.615
Sun Jul 12 17:18:43.755
Sun Jul 12 18:58:09.198
Sun Jul 12 20:02:17.617
Sun Jul 12 21:30:15.170
Sun Jul 12 23:01:01.241
Sun Jul 12 23:51:46.368
Mon Jul 13 00:52:31.643
Mon Jul 13 02:41:16.616
Mon Jul 13 04:12:01.890
Mon Jul 13 05:57:46.613
Mon Jul 13 07:00:52.609
Tue Jul 14 16:19:32.460
Tue Jul 14 17:20:17.612
Tue Jul 14 18:21:02.613
Tue Jul 14 19:21:47.610
Tue Jul 14 20:01:53.611
Tue Jul 14 21:32:38.610
Tue Jul 14 22:03:23.452
Tue Jul 14 22:35:51.691
Tue Jul 14 23:06:56.536
Wed Jul 15 00:52:40.897
Wed Jul 15 02:41:24.535
Wed Jul 15 04:12:09.169
Wed Jul 15 05:57:54.613
Wed Jul 15 07:01:51.680
Wed Jul 15 08:02:35.502
Wed Jul 15 09:03:20.606
Wed Jul 15 10:11:26.677
Wed Jul 15 12:25:08.484
Wed Jul 15 15:09:38.001
Thu Jul 16 04:11:13.624
Thu Jul 16 05:59:58.628
Thu Jul 16 07:01:45.087
Thu Jul 16 08:02:30.605
Thu Jul 16 09:03:15.618
Thu Jul 16 10:04:31.065
Thu Jul 16 12:44:06.798
Thu Jul 16 16:10:53.498
Thu Jul 16 17:39:54.537
This is obviously quite a lot of data, so less is transferred, or you can redirect it to a text file if you want to view it elsewhere.
Finding a Mac’s IP address for a specific date or time
Another option is to look for specially assigned local IP addresses in use on a particular date.The format is YYY ZZZ XX, where YYY is the first three letters of the day, ZZZ is the first three letters of the month, and XX is a numeric date.For example:
cat /var/log/wifi.log |grep "Local IP" |grep "Thu Jul 23"
This will report entries that only match that date:
$ cat /var/log/wifi.log |grep "Local IP" |grep "Thu Jul 23"
Thu Jul 23 00:07:53.688
Thu Jul 23 01:56:38.622
Thu Jul 23 02:23:07.227
Thu Jul 23 04:11:52.817
Thu Jul 23 06:00:37.623
Thu Jul 23 07:01:21.625
Thu Jul 23 08:50:06.748
You can optionally get even more specific and search by the time of day the IP address was assigned, if you are going to search for this remember to use 24 hour time and take into account the time information determined by the machine’s local timezone setting.
Later, for troubleshooting purposes, you can compare the data found in the wifi.log file with the history of connected Wi-Fi networks to uncover more details or troubleshoot an IP address issue on a particular router.
It’s worth noting that some modern versions of MacOS do not include local IP information in wifi.log, but earlier versions of MacOS and Mac OS X do, so if you’re scanning the log files and don’t find the information you’re looking for, be aware what version of MacOS is being used.