Nothing New Under the Sun


from the CNIProject

Accessing hosts file on Mac OSX

/etc/hosts file on Mac OSX

I just put this together to cover a question I was asked recently. Might be useful to someone…
Where is the /etc/hosts file in Mac OS X?

The hosts file used by Mac OS X is in /etc/. Windows users sometimes have problems finding it since there’s no %SystemRoot%\system32\drivers\etc folder in the Mac OS. UNIX users might not expect /etc/ to be hidden by the Mac OS X Finder, so they often look in /Library/Application Support/
Accessing /etc/hosts

/etc/ is hidden by default. The easiest way of getting to the hosts file is to open /Applications/Utilities/ Then type:
sudo nano /etc/hosts

…you will need to type in your password. Your hots file will open in the text editor ‘nano.’
Adding entries to /etc/hosts

On a new line type the IP Address followed by at least one space or tab and then the hostname. Examples: mydevsite.local

…hit ctrl + o to Save, and then ctrl + x to quit the text editor.

See here for more about using /etc/hosts for Virtual Servers: Adding an entry to /etc/hosts on OS X
Background: What is /etc/hosts used for?

The hosts file is a simple way of mapping IP Addresses to hostnames. It overrides mappings provided by the Domain Name System network. The hosts file is commonly used by network administrators to provide access to LAN resources when no name resolution is available. The other common usage is to block access to specified hosts by adding host entries resolving them to — for example —

More Resources:

Print This Post Print This Post
Email This Post Email This Post

No Comments, Comment or Ping

Reply to “Accessing hosts file on Mac OSX”

Add this to your site

Buy the book!

Blaming Eve is unconventional, unashamedly lengthy, and explores a kaleidoscope of issues spanning over a decade of thought. Thematically addressing love, race, gender, social, and religious issues, Blaming Eve is bold and intense.

web design gallery

Submit your website to 20 Search Engines - FREE with ineedhits!

Free Search Engine Submission

Visitor Map
Create your own visitor map!