Jump to content
Welcome to InsanelyMac Forum

Register now to gain access to all of our features. Once registered and logged in, you will be able to contribute to this site by submitting your own content or replying to existing content. You'll be able to customize your profile, receive reputation points as a reward for submitting content, while also communicating with other members via your own private inbox, plus much more! This message will be removed once you have signed in.

  • Announcements

    • Allan

      Forum Rules   04/13/2018

      Hello folks! As some things are being fixed, we'll keep you updated. Per hour the Forum Rules don't have a dedicated "Tab", so here is the place that we have our Rules back. New Users Lounge > [READ] - InsanelyMac Forum Rules - The InsanelyMac Staff Team. 
Sign in to follow this  

How to edit the hosts file in Mac OS X

5 posts in this topic

Recommended Posts

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. – 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:

Share this post

Link to post
Share on other sites

Ok,resolved :wink2: don't glory,Mountain lion is a Puma in animal World

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.