Monday, 09 August 2010 14:34

Working with a HOSTS File - Mac and PC Methods

Need to update your HOSTS file to point a domain to a different IP address?  Below are instructions for both PC (Windows 7) and Mac (OS X Snow Leopard) platforms.

How to Update your HOSTS file on a PC:

a.  Open Notepad (start -> programs -> accessories -> notepad)
pc_open
b.  In Notepad, open the file c:\windows\system32\etc\hosts (no extension; you will need to choose "All Files" instead of Text files in the browse window)
pc_edit
c.  Add your new IP address / domain lines at the bottom of this file
d.  Save and close Notepad

How to Update your HOSTS file on a Mac:


[Edit: I have found an easier way to do this - the following TERMINAL command will prompt you for your OS X password and launch Text Edit as the root user]

sudo /Applications/TextEdit.app/Contents/MacOS/TextEdit /etc/hosts

[Edit Again: With OSX Lion, the above command no longer works, use this instead:]

sudo nano /etc/hosts


a.  Open Terminal (Applications -> Utilities -> Terminal)
mac_open
b.  Type this command into Termainal: "sudo nano /private/etc/hosts" (without the quotes)
mac_edit
c.  The hosts file contains some comments (lines starting with the # symbol), as well as some default hostname mappings (e.g. 127.0.0.1 – localhost).  Simply append your new mappings underneath the default ones. Or edit one of the default values if you know what you are doing!  You can navigate the file using the arrow keys.  When done editing the hosts file, press control-o to save the file.  Press enter on the filename prompt, and control-x to exit the editor.
d.  On Leopard you can issue a simple Terminal command to flush the DNS cache, and have your host file changes to take immediate effect: "dscacheutil -flushcache" (without the quotes)

Last modified on Monday, 20 May 2019 17:37
Comments (0)
There are no comments posted here yet
Leave your comments
Posting as Guest
×
Suggested Locations

Call or email today for a free consultation:

Monday - Friday 9-5 ET
570.508.6881
office@covingtoncreations.com

Latest Comments

Got a similar email that seemed suspicious. Ignored it and they even followed up today.
My organization received one of these emails from "Linda," but uses https://www.bestprosintown.com/p...
Hi Nate, I got the same email template from the same email address today and found you through a ...
Just received one today (16 Aug 2022) from "Mailchimp". Thanks for sharing!
Thanks for posting this. I just got one today. I was 99% sure it was a scam, and your post confirmed...


Design & Development

Wordpress, Drupal, Joomla
New custom websites
Bespoke themes and extensions
Redesigns, upgrades, migrations

Web Design & Development


Optimization & SEO

Let us optimize and manage your overall online presence. We offer full service monthly SEO as well as one-time projects.  

Optimization Plans & Pricing


Maintenance, Patching

White glove monthly backups, security updates, maintenance and testing for your Wordpress, Drupal, or Joomla site.

Maintenance Plans & Pricing


Email Newsletter

Bring your web & marketing performance to the next level: monthly blog post roundup via email.  

Stay in Touch!

Member

scranton chamber crop