Jump to content

How to edit the hosts file in Mac OS X


  • Please log in to reply
4 replies to this topic

#1
HUSABER

HUSABER

    InsanelyMac Legend

  • Members
  • PipPipPipPipPipPipPip
  • 877 posts
  • Gender:Male
  • Location:Cyprus
  • Interests:HusabergFC-600 FourStroke,KTM500 TwoStroke,TM300 TwoStroke
    Free Time-My Hackintosh&Ap...

How to edit the hosts file in Mac OS X 10.7 – Lion,10.8ML

The hosts file is a text file that maps hostnames to IP addresses. Upon typing a url address in the browser, the system first checks if there is a relevant entry in the hosts file and if exists gets the corresponding IP address. If no entries exists it resolves the IP via the active connection’s DNS servers.
The hosts file can be edited to block certain hostsnames, like ad-serving/malicious hosts,activation app or used for web development purposes, i.e. to redirect domains to local addresses.

Step 1 – Open the Terminal.app
Either start typing Terminal in the Spotlight search, or goto Applications > Utilities > Terminal.
Step 2 – Open the host file
Open the hosts file by typing the following in the Terminal window:
$ sudo nano /private/etc/hosts
Type your user password when prompted.
Step 3 – Edit the hosts file
The hosts file contains some comments (lines starting with the # symbol), as well as some default hostname mappings (e.g. 127.0.0.1 – local host). Simply append your new mappings underneath the default ones.
Step 4 – Save the hosts file
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.
Step 5 – Flush the DNS cache
You can use a simple Terminal command to flush the DNS cache, and have your host file changes take immediate effect. Using the open Terminal window, then the following command:
$ dscacheutil -flushcache
Your new mappings should now take effect. :thumbsup_anim:



#2
3.14r2

3.14r2

    The Round One

  • Members
  • PipPipPipPipPipPipPipPip
  • 1,333 posts
  • Location:Molvania

...Mac OS X 10.7 – Lion,10.8-Puma

10.8 - Puma?! Either 10.8 - Mountain Lion or 10.9 - Not yet known :)

BTW Puma is OS X.1

#3
HUSABER

HUSABER

    InsanelyMac Legend

  • Members
  • PipPipPipPipPipPipPip
  • 877 posts
  • Gender:Male
  • Location:Cyprus
  • Interests:HusabergFC-600 FourStroke,KTM500 TwoStroke,TM300 TwoStroke
    Free Time-My Hackintosh&Ap...
Ok,resolved :wink2: don't glory,Mountain lion is a Puma in animal World

#4
Gringo Vermelho

Gringo Vermelho

    The Jan Bird fix

  • Supervisors
  • 6,111 posts
  • Gender:Male
  • Location:Brazil
I use this, much easier:

http://www.apple.com...ostswidget.html

#5
HUSABER

HUSABER

    InsanelyMac Legend

  • Members
  • PipPipPipPipPipPipPip
  • 877 posts
  • Gender:Male
  • Location:Cyprus
  • Interests:HusabergFC-600 FourStroke,KTM500 TwoStroke,TM300 TwoStroke
    Free Time-My Hackintosh&Ap...
Gas Mask is the best,everything i send there:

Attached Files







0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

© 2014 InsanelyMac  |   News  |   Forum  |   Downloads  |   OSx86 Wiki  |   Mac Netbook  |   PHP hosting by CatN  |   Designed by Ed Gain  |   Logo by irfan  |   Privacy Policy