Flush DNS

Step 1: Open the Terminal
Navigate to Applications -> Utilities -> Terminal

Step 2: Flush DNS – Type the following command and hit enter.
Mac OS X Yosemite and later


sudo killall -HUP mDNSResponder

Mac OS X Yosemite v10.10 through v10.10.3

sudo discoveryutil mdnsflushcache

Mac OS X Mavericks, Mountain Lion and Lion

sudo killall -HUP mDNSResponder

Mac OS X Snow Leopard

sudo dscacheutil -flushcache

Hostname, ComputerName, LocalHostName

Setting Hostname, ComputerName, LocalHostName

Example:

scutil --set HostName yosemite.local
scutil --set ComputerName yosemite
scutil --set LocalHostName yosemite

scutil --get LocalHostName yosemite

notes: flush directory service cache

scutil –set HostName yosemite.local && scutil –set ComputerName yosemite && scutil –set LocalHostName yosemite

dscacheutil

NAME
dscacheutil — gather information, statistics and initiate queries to the Directory Service cache.

Example:

dscacheutil -flushcache

notes: flush directory service cache