Flushing the DNS cache in OS X is easy, but the commands to do so are unique to different versions of OS X. We'll list the commands for the different versions of OS X.
You'll need to know which version of OS X you're running on your Mac, so click the Apple logo in the upper left hand corner of your Desktop, and then click "About This Mac" in the pull-down menu. A window will pop up on your desktop listing the version of Mac OS X you are currently running.
Make a note of the version, and close the window.
Flush DNS Caches in OS X Yosemite 10.10.4 and OS X El Capitan 10.11
From OS X 10.10.4 moving onward, including 10.11, Apple has ditched discoveryd and has replaced it (or rather, reverted back to)
mDNSResponder. Thus, to clear DNS caches in OS X Yosemite 10.10.4, and 10.11 El Capitan, and presumably onward, the command string is as follows:
$ sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder;say cache flushed
Flush DNS Caches in OS X Yosemite (10.10, 10.10.1, 10.10.2, 10.10.3)
$ sudo discoveryutil mdnsflushcache; sudo discoveryutil udnsflushcaches;say flushed
Flush DNS Caches OS X 10.9 Mavericks
The latest version of OS X requires the following commands entered in the Terminal in order to flush DNS Caches:
$ dscacheutil -flushcache; sudo killall -HUP mDNSResponder
You will need to enter the administrator password for this task to complete.
These commands combine killing mDNSResponder with the standard dscacheutil, making it a two step process to first, flush the cache, then reload the DNS handling in OS X to make the changes take effect.
Flush DNS Caches in OS X 10.8 Mountain Lion and 10.7 Lion
To flush DNS Cache in OS X Lion (10.7) and OS X Mountain Lion (10.8), launch Terminal and enter the following command. (You will need to enter an administrative password.)
$ sudo killall -HUP mDNSResponder
Flush DNS Cache in Mac OS X 10.6 and Mac OS X 10.5
Launch Terminal and issue the following command:
$ dscacheutil -flushcache