-
Hosts File Editor For Mac카테고리 없음 2021. 5. 26. 20:44
What is hosts file and how does it differ from DNS?
First of all, what is the hosts file, and how does it differ from the more commonly known DNS?
- Editing your hosts file incorrectly can have adverse effects on your Mac. You should only attempt to edit the hosts file if you have a clear purpose for doing so and are confident in your understanding of Terminal commands.
- The Mac Hosts File: How to Modify /etc/hosts in OS X with TextEdit Feb 29, 2016 - 14 Comments The Mac hosts file is a system level file located at /etc/hosts which maps IP addresses to host names for Mac OS X networking.
The Domain Name System is the database that corresponds an IP address’ “dotted quad” numerical format with a website’s alphabetized web address. It’s a giant directory of which name belongs to which IP address, like an online yellow pages.
Edit Your Mac Hosts File with Text Edit. There are two primary ways to edit the hosts file in Mac OS X. The first is by using TextEdit, since the hosts file is merely a simple plain text document.
Your Mac’s hosts file, however, is localized to your own device, like a list of contacts in your phone: The web address acts as your contact’s name — that’s how you find who you want to talk to — and the IP address is their cell phone number, which is your actual way of getting in touch with them.
How editing the hosts file works
Editing your Mac hosts file is a bit like changing the phone number in your contact book. If you save the contact details with the wrong name, well, it’s still going to connect to that person when you ring the contact. If, however, you entered an incorrect phone number in our contacts analogy, whether that’s an invalid number or one that links to someone else’s, then you have no chance of getting through to that particular cell phone.
Editing the hosts file reroutes the IP address, but only from your own Mac. Entering the web address will bounce you to a different IP address of your choosing (and therefore a different website) or to an invalid IP, which will give you an error page on your browser that says it can’t find the site you’re looking for.
Can it boost my Mac's speed?
Editing a hosts file is a way to speed up your browser performance. But if you're tired of half-measures and want some solid improvement, we recommend a full browser cleanup, including deletion of browser cache. Our personal favorite is CleanMyMac as it has a tool to uninstall browser extensions and the rest of the garbage Macs accumulate from the web, emails and message chats. Check it out — it's available for a free download here.
So why would you want to change your hosts file?
Typically if you enter a web address in your browser, it’s because you want to reach that IP address. So what are the benefits of rerouting?
Network Testing: If you’re developing a network, you can reroute the real domain name to the development site to see how real users experience it. This will not affect other users accessing the real site.
Block Malicious Sites: Apart from the risk of viruses and malware, undetected add-ons can also find their way into your system and begin slowing things down. Although it’s always worth investing in pop-up ad blockers, editing the hosts file prevents known malicious sites from being accessed. If a link or pop-up attempts to enter the site, your OS simply re-routes it and takes you to a safer page.
Increased Speed: As we said earlier, finding a website via the DNS is like flicking through the yellow pages for the correct address. With the hosts file being localized to your Mac, this could potentially speed up your browsing by omitting the middle man.
Improved Productivity: Maybe you or your team are getting distracted with social media sites or video streaming. Blocking access to time-wasting sites is a good way of keeping focused on the job at hand.
How to edit the hosts file with Terminal
Note: You will need administrator privileges, including the password, to edit the Mac hosts file.
1) Find the Terminal application on your system. You can do this by either:
- Use the Spotlight application to search for it.
- Select Applications from the sidebar of a Finder window, and from there select Utilities and then double-click on Terminal.
2) Once you have the Terminal window open, you can access the Nano text editor, which is where you will edit the hosts file. Type sudo nano /etc/hostsand hit Enter. You’ll then be prompted for your administrator password. Once you’ve entered it, hit Enter again and you will be in the Nano text editor.
The Nano text editor might look intimidating if you’re not used to coding on your OS, but don’t worry: it’s very simple, and very easy to do.
3) Use your keyboard arrow keys to position your cursor beneath the text that is already there. This is where you’re going to enter your alternative IP address. Type the IP address that you want the site to reroute to, hit tab, and then type the domain name you want to be associated with it. So, if you would prefer that YouTube reroutes to your homepage, simply type the numerical IP address of your site, hit Tab, and then type www.youtube.com. To add another entry, simply enter a new line of text.
If you have no particular alternative site in mind, or you simply want to block access to it entirely, you can either enter an invalid IP address, such as 000.0.0.100, or use 127.0.01, which always refers back to your own system.
4) Save the changes by pressing control and O, and then exit the Nano text editor by pressing control and X, which will return you to the main Terminal screen.
5) To make sure your Mac doesn’t get confused by the conflicting information from its hosts file and the DNS, before you exit the command line type sudo killall -HUP mDNSResponderand hit Return. This clears your Mac’s DNS caches so that the old directory doesn’t conflict with your newly updated hosts file.
How to edit the hosts file with TextEdit
An alternative to the Terminal application is to use TextEdit instead.
1) Click Finder > Go > Go to Folder...
Then type /private/etc/hosts and press Go. This will locate the hosts file in the ‘etc’ folder.2) Copy the file onto your desktop, and then double-click the copied file to edit it. In the open text file, add your line of alternative IP addresses just as you would in Terminal: First the rerouted IP address and then the corresponding domain name. Make sure that there is a space between the IP address and the domain name, otherwise it won't work.
If you don't want your Mac to access certain websites, use 127.0.0.1 for IP address. This will reroute the address back to your Mac. For example, if I wanted to block the access to Facebook on a particular Mac, I would edit hosts file to look like this:
Note: If the file is locked to prevent you from editing it, which is likely if you’re running on OS X 10.11 or later, you must disable SIP protection before you can make any changes.
3) Save the file, and then drag it back into the ‘etc’ folder. Your Mac will ask if you want to replace the file, which you do, and you will have to enter your administrator password to save the changes.
Remember, even if you own the domain name you are rerouting, the web address itself will not be affected. The hosts file only changes what happens on the Mac that contains it.
The risks of editing hosts file
Remember, you’re rerouting a domain to an IP address, not specifically a website. So if you have set one domain to be sent to another site, this depends on the IP address staying the same. If the destination website changes its IP address, your new route will no longer be valid, with the domain either ending up in a new website or producing an error message.
If your server is still taking too long to process requests, it may not be the DNS lookup that is slowing you down. It might be worth running a full clean of your OS to make sure the lag isn’t coming from your Mac.
How else you can protect privacy on your macOS
Anyone reading this is concerned enough about privacy and security to want to find a solution. As we’ve outlined in this article, there are several ways this can be done manually. Some of these fixes take time. Other solutions are fairly quick and easy to implement.
With CleanMyMac X, you can clean your system cache, user cache (which includes app and DNS cache history) and your browser cache. Of course, there is the manual way, as outlined in this article, or you can save a lot of time with one download and a few clicks to remove any digital footprints you want to delete.
If you want to clear cache safely and easily, here is how you can with CleanMyMac X:
- Launch CleanMyMac X (download it for free here)
- Select System Junk.
- Click Scan > Clean.
In case you need to remove just DNS cache, do the following:
- Go to the Maintenance module.
- Choose Flush DNS Cache.
- Click Run.
Done! Your DNS cache flushed.
That’s all you need to do. Give it a try, or go through the steps outlined above to do this manually.
These might also interest you:
We may see the need of having to edit sometime Hosts file from your computer to create a mapping between an IP address and a domain name.
Today it is not very usual to deal with the Host file because there are DNS servers and when we write in any browser a domain name servers DNS are responsible for the correct IP address.
However even it used, for example, block a website or block some content as it can be advertising.
To review the changes in the Hosting server while another server DNS point to the solution is to edit the Hosts file .
Host OS X file is a file where the system stores the correspondence between Internet domain names and IP addresses. Until it began to use servers DNS , the Host file was responsible for resolving domain names. Today you do not need but know how to modify the Host file in OS X may be interesting. For example, we may be useful to block access to certain web pages.
In OS X a way to edit the Host file is to use Terminal. We launched by the terminal and the order
sudo pico /private/etc/hosts
With Pico we will be able to make the appropriate changes. It is not difficult but of course remember as editor and launch the file path in OS X is in the directory / private / etc / hosts. So, is a simpler method? Yes, thanks to a preference pane that you can install.
Hosts is a small application that is installed in the System Preferences panel in OS X and gives us access to Host OS X file . From it we can add the IP address, the server name (hostname) and select whether or not we want to be active modification. Everything very visual way.
In this guide we will guide users of Mac OS X (Mac OS now) so you can edit the host file on their computers.
Hosts File Edit from the Terminal
Mac OS X has a tool called Terminal which is nothing more than a command console where we can perform operations by typing command lines.
Although no previous experience with the command line and new users may seem somewhat complicated to use, it is how fast and effective editing the hosts file on Mac.
To open the terminal we can perform a Spotlight search and write Terminal
Or search inside the folder Utilities in Applications.
Once the application starts, you will see a window where the name of your machine appears and where we have to copy the following line of text and press Enter :
We will ask the administrator password , which is usually the same as we when the computer starts if we are managers. If not we talk to the computer administrator.
Important! The password characters are not displayed while write, in fact not even move the courses, but it is not an error. We must enter the password and press Enter on the keyboard.
If all goes well we will see in the window ends something like this:
To move through this window you can use the arrow keys until you reach a blank line and add the IP server followed by the domain you want. Would be something like:
To save the changes we need to use the key combination Ctrl + O (letter O is not a zero) followed by Enter .
To close the window we will use the key combination Control + X
Finally, we can clear the cache by adding the following command in the terminal and pressing Enter .
And we can close the terminal window, but if you want to check that everything went well you can use to make a ping and see that it is pointing to the correct IP address.
It’s simple, simply type ping followed by the domain. This will return an IP address. If you have changed it is that everything is fine. If not we repeat the process.
Locate the Hosts file and edit it from the Finder
Depending on the version of Mac OS X being used can vary, but for some time we can find in the following path:
The problem is that the directory private is a hidden file, so if we find browsing the Finder will not locate it.
If we want to access the folder we can use the function Go to Folder … offered by the Mac OS X Finder from the menu Go .
This will open a window where you can write / private / etc which will lead us directly to the folder where the Hosts file is hosted.
Once we located we can drag the desktop to make a copy of it that we can edit. If we try to edit from the folder itself where it is, we tell you that we do not have sufficient permissions.
Once there you can edit it open with TEXEDIT, for example.
How to edit the Hosts file is very simple, we must put an IP address, leave a blank and add the domain name:
In the Hosts file would look like this:
Once edited and saved must save the changes and move back to the folder / private / etc .
In doing so we will ask you to identify us as our computer administrators password
We also tell you that there is already a file named hosts and if we want to save both files, stop the transfer or replace. Will click Replace .
Hosts File Editor
Only after that will we enter our password to transfer the edited hosts file to the folder / private / etc and that the changes we have made are applied.
You can use the Terminal to make a ping and check that you return the IP address you have added as we indicated in the previous step.
Do not forget to remove the changes to the Hosts file when they are no longer necessary lest you cause problems in the future.
Editing the Hosts file in Windows 10
One of the main “problems” that occurs when making a change hosting provider is that before deregister the old provider we must ensure that our web page loads and works well under the new provider .
There is a way “local” to do so only on the computer that changes will be made to indicate you can see there the content uploaded to the new server, without harming what is currently displayed on the Internet.
Steps to follow:
Suppose we are with another provider and want to migrate our web Hosting to see how it would look here, but without changing our domain dns , otherwise this would cease to point to the old provider. And if we have raised the evil web servers Hosting this would be displayed with failures resulting from having migrated wrong. Or even if we have created in “local” in our PC and want to upload it to the server to see how it would be published on the network.
Locate Server IP
First of all we have to do is locate the server IP as the need to put in the host file Window10 .
To do this, in cPanel, we should go to the block “Domains” and access the “Editor single zone” or “Advanced Editor zone”.
No matter which of the two we select areas, since in any of them you can see which is the IP Hosting on the bottom.
The IP Hosting will we see repeated on several occasions by the bottom:
All right! We know the IP of our web hosting.
Locate the Hosts file in Windows 10
This is where there are often problems sometimes not in itself to locate this file, but because it does not usually make the changes correctly.
In Windows 10 the file can be located in the following path:
C: Windows System32 drivers etcBut … What is the HOSTS file?
We can take this file as an address book. When entering an address in the browser, the system searches the hosts file to check whether the IP to which will access is included . If it is, it makes the call and load the site. If not, you would ask your ISP. Not being our web site with a domain, the ISP does not know our address and not the page load is performed. That is, the hosts file lets you override the DNS for a domain on the machine on which it ‘s set.
Edit the Hosts file in Windows 10
To do this, click on the start menu below entirely to the left of Windows 10 and type “Notepad” .
Then, we click on the right mouse button on the application site and click on “Run as Administrator”(you can ask our user password or accept that we want to make changes to the computer).
Then in notepad, click on “File” -> “Open” .
We look for the host file in the path:
C: Windows System32 drivers etcDefault not appear to us, so in the dropdown on the right we have to give “All files” .
Select the hosts file and give it to “Open” ; right below “All files”.
Once completely-open we -down add the IP that we indicated before and nuestrodominio.com (replacing the corresponding nuestrodominio.com) put it first and then without www www (leaving a blank space between each item). As shown in the following screenshot:
The order would be:
[IP of our domain] blank [domain name without www] blank [domain name www]And finally, click on “File” -> “Save” to save the change made . We tried to reload the page in your web browser and that’s it.
In this way we will have our hosts file edited in the correct way to load our website “local” form under the Hosting server.Check IP
To verify that your computer’s IP pointing just introduced can make a simple operation called Ping ( Packet Internet Grouper ). With this action we can check the status of the connection through request packets question and answer to determine whether a particular IP is accessible from your Internet connection.
How to Ping in Windows 10?
To ping in Windows 10, click on the start menu below all left, we write “cmd and click on” Command Prompt “.
Text File Editor For Mac
Contents
- 3 Editing the Hosts file in Windows 10
- 5 Locate the Hosts file in Windows 10
- 7 Check IP