Site sections
Editor's Choice:
- Password recovery in Ask
- How to turn on the camera on a laptop
- Why doesn't music play on VKontakte?
- How to increase the size of drive C at the expense of drive D without losing data
- Causes of malfunctions on the motherboard If the chipset on the motherboard burns out
- Original name for chat
- Using styles in Excel How to create your own new style
- What errors occur during installation?
- Social status of a person in society
- Full interpretation of errors
Advertising
Hosts where it is located in mac os. How to open and edit the hosts file on macOS |
Most of us, for one reason or another, have had to deal with a rather important file in any operating system called "hosts" and its editing. This file is used to map certain domain names to their network addresses and, unlike DNS, is controlled by the administrator of each specific computer, i.e. locally. And if Windows users who have already encountered this file and its editing are familiar with this concept and, most likely, remember the path to the desired file by heart (but, just in case, we will remind you -Windows\system32\drivers\etc\hosts), then new users of Apple computers running Mac OS X (macOS) are often lost at first, not finding the desired hosts file in their usual path, as well as the path itself in their Mac. It's about where is the hosts file on mac and what's his name open And edit We will tell you in this detailed instructions below. Fortunately, finding and editing the hosts file on a Mac is no more difficult than doing it on a Microsoft operating system. We know of at least two methods, which will be discussed below. You can use whichever one you find faster and more convenient. How to open hosts file via Mac OS terminalThose users of Apple technology who are not afraid of the word “terminal” will find this method the fastest and most convenient. To view and edit the hosts file on Mac and enter the following command in it.
You will also need to enter an administrator password, if one is set on your computer. If you entered everything correctly, the contents of your Mac’s hosts file will open in front of you. Make the necessary changes to this file (the mouse cursor does not work in the terminal, use the keyboard arrows to move between lines), for example, add the site that you want to block. After making all the necessary changes, press the keyboard shortcut "ctrl+X" to save. Press the key "Y" to confirm saving changes. That's all, the hosts file has been successfully edited. In order for the changes you make to take effect immediately, you sometimes need your Mac. How to open the hosts file in a text editorFor those Mac users who are not yet very familiar with the Terminal, there is an alternative option to open and edit the hosts file using your favorite text editor and the standard Finder file manager. To do this, right-click (or use a similar trackpad action) on the Finder icon on the bottom panel (Dock) of your computer and select the item from the drop-down menu "Go to folder...". In the window that opens, enter the path where the hosts file is located on computers with the OS X operating system and click the "Go" button. The path looks like this: As a result, a Finder window will open in the folder in which the file you are looking for is located. It will already be selected. Just right-click on it and open it using your favorite text editor (standard TextEdit will do). The file itself is protected from editing. However, when you try to make changes, you will be asked to create a copy of it - do so. Make the necessary changes to a copy of the file and save it, for example, on your desktop as a file called hosts. Then delete the .txt permission from the saved file. In the last point of this instruction, you just need to replace the old hosts file with a freshly created one by simply dragging it from the desktop to the folder where the original file is located. In the pop-up window, confirm the action by clicking the button "Replace". This is all. As a result of the described actions, your computer will use a new hosts file. But sometimes, in order for the changes to take effect immediately, you may need to update the DNS cache. More on this below. Update your DNS cacheIn most cases, the changes you make in the hosts file will be applied immediately, but if for some reason this does not happen, don’t worry, try resetting the DNS cache. To do this, run the following command in a terminal (you will need to enter the administrator password).
After this, the rules specified in the new hosts file will definitely work as they should. Need to edit or modify the hosts file on a Mac? This guide will show you exactly how to edit the hosts file in Mac OS. You’ll find hosts in Mac OS X is stored at /private/etc/hosts but it can also be accessed at the more traditional location of /etc/hosts. That said, if you’re looking to edit hosts, you’ll want to target the file located in /private/etc/ though. We'll walk through how to manually edit the hosts file in MacOS Mojave, MacOS Catalina, MacOS High Sierra, MacOS Sierra, OS X El Capitan, Yosemite, OS X Lion, OS X Mountain Lion, and OS X Mavericks, this will be done with the command line using the simple text editor called nano. Don’t let the command line or Terminal sound intimidating though because it’s not, we’ll make the entire process of editing a Mac hosts file super easy. How to Edit Hosts File on Mac OSLet’s get started making some edits to /etc/hosts in macOS and Mac OS X!
sudo nano /private/etc/hosts You can verify your hosts modifications immediately with ping, Safari, or any other network app. Changes take effect immediately though some adjustments may need to be accompanied by a which can be done with the following command in macOS 10.12+ through OS X 10.9: dscacheutil -flushcache;sudo killall -HUP mDNSResponder When flushing DNS cache with that command you will need to enter the admin password. If you’d like to see how this entire process is accomplished before doing it yourself, watch the video below to see a demonstration of the hosts file being modified on OS X to block the website ‘yahoo.com’ from loading:
Note: the procedure is the same with older versions of Mac OS X, though the path to hosts could be /etc/hosts if the version of OS X is dated significantly. Tips to Consider When Editing Hosts FilesThe following tips go beyond OS X and apply to any hosts file, be it on a Mac, Windows, or Linux.
Making a backup of the hosts file can be a good idea if you plan on making significant changes or just want to play around with modifications and see what happens, a simple way to do that would be to use this command, which would store a backup in your home ~/Documents/ folder: sudo cp /private/etc/hosts ~/Documents/hosts-backup Then, if you wanted to restore the modified hosts to the backup of the original file, you just have to swap the paths like so and rename the file again: sudo cp ~/Documents/hosts-backup /private/etc/hosts That’s it, though again you may need to flush the DNS for changes to take effect. Finally, it’s worth mentioning that if you’d prefer to avoid the Terminal and the command line completely, you could to modify the contents of hosts that way through System Preferences instead. Generally speaking though, we recommend just using the tools that are built directly into the Mac. Let us know in the comments if you have any questions or tips. For developers of websites and client-server applications on Mac OS HOSTS file serves as a convenient software debugging tool. The file has a line format, where each entry describes the order in which domain names are resolved on a given computer. Managing virtual subnets is an important function for any computer with Internet access. TechnologyTo open a web page, we specify its address, which includes the domain name. So, the domain is apple.com. Physically, the page is located on an Apple server, which has some IPv4 address, for example: 205.192.12.11. To turn “apple.com” into an IP address, you need to contact the zone.com domain name server (in other words, the DNS server of the COM domain). Server addresses.com, .ru, etc. are known in advance and are needed for the browser to work. The HOSTS file has entries similar to the server's DNS table, with the file data taking precedence over the external DNS. This means that if you specify the IP address of your computer and the path to the folder in which a certain web page is located as the address for the apple.com domain, then it will be loaded in browsers and other third-party applications when you enter apple.com in the address bar. This mechanism helps to test server programs before actually uploading them to the Internet. How to edit postsOn Mac OS HOSTS file located in system memory, so you can open it through the terminal.
A standard hosts file entry is to map the computer's standard address to the localhost domain. User data can then be recorded. If you want to map the mysite.com domain to the address 200.200.1.1, you need to add the line “200.200.1.1 mysite.com” The file structure is practically no different from HOSTS for Windows. It is important when editing to save the broadcast address (entry from 255.255.255.255), which is used for mass distribution of network packets. If the Internet and local network settings provide for the use of the IPv6 protocol, the localhost address must also be described for it. In addition to redirection, there may be a block of closed addresses (suspicious sites found by the antivirus are included here), which begins with the line “# Block”. Fair, not overpriced and not underestimated. There should be prices on the Service website. Necessarily! without asterisks, clear and detailed, where technically possible - as accurate and concise as possible. If spare parts are available, up to 85% of complex repairs can be completed in 1-2 days. Modular repairs require much less time. The website indicates the approximate duration of any repair. Warranty and responsibility A guarantee must be given for any repairs. Everything is described on the website and in the documents. The guarantee is self-confidence and respect for you. A 3-6 month warranty is good and sufficient. It is needed to check quality and hidden defects that cannot be detected immediately. You see honest and realistic terms (not 3 years), you can be sure that they will help you. Half the success in Apple repair is the quality and reliability of spare parts, so a good service works directly with suppliers, there are always several reliable channels and your own warehouse with proven spare parts for current models, so you don’t have to waste extra time. Free diagnostics This is very important and has already become a rule of good manners for the service center. Diagnostics is the most difficult and important part of the repair, but you don't have to pay a penny for it, even if you don't repair the device based on its results. Service repairs and delivery A good service values your time, so it offers free delivery. And for the same reason, repairs are carried out only in the workshop of a service center: they can be done correctly and according to technology only in a prepared place. Convenient schedule If the Service works for you, and not for itself, then it is always open! absolutely. The schedule should be convenient to fit in before and after work. Good service works on weekends and holidays. We are waiting for you and working on your devices every day: 9:00 - 21:00 The reputation of professionals consists of several points Company age and experience Reliable and experienced service has been known for a long time. How many masters in areas If there are always several engineers waiting for you for each type of equipment, you can be sure: Technical literacy If you ask a question, a specialist should answer it as accurately as possible. On Mac OS, the hosts file is located in the /etc folder. It can be edited using a visual text editor. First of all, you need to give yourself access to modify the /etc folder and the hosts file located in it. To do this, open the Finder tab Transition, and click the line (Fig. A9.1). Rice. P9.1. Go to folder. A window will appear on the screen. You need to enter the line /etc in the field of the same name, as shown in Fig. P9.2, and then click the button Go.
You will see a fairly large list of files located in the /etc folder (Figure A9.3).
Once you have navigated to the /etc folder, you need to configure access rights. By default, you do not have rights to change the hosts file; you will have to add them manually. To add permissions, immediately after navigating to the folder, select Change File line Properties. You will see the etc folder properties window shown in Fig. P9.4.
Here you need to first unlock the changes by clicking the lock icon in the bottom left corner of the window, and then use the "+" icon to add your account and allow operations for it Read and write. In Fig. P9.4 these rights have already been added. At the next stage, add the same rights to the hosts file. To do this, find the file in the list shown in Fig. P9.3, select the file, and then select Change again File line Properties. Now you will see a window for setting the properties of the hosts file, similar to that shown in Fig. P9.4. Add your account and rights in this window, similar to the /etc folder. After changing the permissions, double-click the hosts file to edit. An editor window will appear, shown in Fig. P9.5.
You will need to add the lines received from our technical support to the end of the file, and then save the file. |
Read: |
---|
New
- How to turn on the camera on a laptop
- Why doesn't music play on VKontakte?
- How to increase the size of drive C at the expense of drive D without losing data
- Causes of malfunctions on the motherboard If the chipset on the motherboard burns out
- Original name for chat
- Using styles in Excel How to create your own new style
- What errors occur during installation?
- Social status of a person in society
- Full interpretation of errors
- How to call a “live” Beeline operator directly: toll-free phone numbers