• Как открыть файл hosts mac. Как отредактировать файл Hosts на Mac. Как отредактировать файл Hosts

    First of all, what is the hosts file, and how does it differ from the more commonly known DNS?

    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.

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

    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/hosts and 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 mDNSResponder and 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 , 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:

    1. Launch CleanMyMac X ()
    2. Select System Junk.
    3. Click Scan > Clean.

    In case you need to remove just DNS cache, do the following:

    1. Go to the Maintenance module.
    2. Choose Flush DNS Cache.
    3. 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.

    By editing Mac hosts file, it’s possible to emulate DNS change and set the desired IP for a domain name. With the hosts file you can overwrite any DNS values set by your Internet service provider. This is helpful if your domain name is not yet registered or not pointed to a hosting account, but you want to preview your website.

    In this tutorial you will learn how to edit the hosts file on Mac. For a tutorial on how to do the same on Windows .

    IMPORTANT: Note that changes made for the hosts file will affect your computer only.

    What you’ll need

    Before you begin this guide, you’ll need the following:

    • root user privileges

    Step 1 – Opening Hosts File

    Follow these steps to open your hosts file on Mac:

    Step 2 – Editing Hosts File on Mac

    In order to emulate DNS change and point domain name to an IP address, use the following syntax:

    IP_Address domain.com IP_Address www.domain.com

    For example, to emulate DNS change for сайт and www.сайт we would have to include the following lines at the bottom of hosts file.

    93.188.160..188.160.58 www.сайт

    This will emulate change IP address of the сайт and www.сайт to 93.188.160.58.

    Once you are done with editing hosts file, press CMD + X on your keyboard, enter Y to save changes and hit ENTER button.

    Step 3 – Flushing DNS Cache (Optional)

    Sometimes changes do not apply instantly and you may need to flush the DNS cache. On Mac, DNS cache can be easily flushed by executing the following command:

    Mac OS X Snow Leopard

    Sudo dscacheutil -flushcache

    OS X Mavericks, Mountain Lion, and Lion

    Sudo discoveryutil mdnsflushcache

    Conclusion

    That’s it, by finishing this short tutorial, you have learned how to edit a hosts file on Mac. This is useful if your domain name is not registered or not pointed to the server, but you want to preview your website. In addition, you have also learned how to flush the DNS cache on Mac.

    Активные пользователи компьютеров наверняка знакомы с файлом Hosts, который содержит в себе сетевую информацию. Через него можно произвести блокировку доступа к определенному сайту с компьютера, либо внести другие изменения в обращение компьютера к отдельному IP-адресу. Несмотря на всю закрытость операционной системы Mac OS от вмешательства со стороны пользователей, в ней можно отредактировать файл Hosts. При этом провести редактирование ничуть не труднее, чем на Windows, и в рамках данной статьи мы рассмотрим, как это сделать.

    Оглавление:

    Как открыть и редактировать Hosts через “Терминал”

    Самый простой способ получить доступ к редактированию файла - это воспользоваться командной строкой, которая в Mac OS носит название . Запустить утилиту “Терминал” можно через Finder, она расположена в списке стандартных программ операционной системы, либо через поиск, введя ее название.

    Запустив “Терминал”, введите следующую команду и исполните ее, чтобы перейти в редактирование файла Hosts:

    Sudo nano /private/etc/hosts

    После активации команды потребуется также ввести пароль администратора компьютера, поскольку вмешательство в Hosts достаточно серьезное, и при неправильном редактировании файла могут возникнуть проблемы с доступом к некоторым сайтам в интернете.

    После ввода пароля появится непосредственно содержимое файла Hosts, которое пользователь может редактировать. Мышка при редактировании файла через “Терминал” не работает, то есть перемещаться между строчками файла можно только клавиатурой. Введите изменения, которые вы хотели бы внести в файл Hosts. Чтобы сохранить изменения в файле, нужно нажать на клавиатуре Ctrl+X. Далее появится сообщение, точно ли вы хотите изменить Hosts, подтвердите действия кнопкой “Y”.

    Как открыть и редактировать Hosts в Mac OS через Finder

    Второй вариант получить доступ к Hosts и отредактировать файл - это использовать стандартный Finder. Данным способом можно открыть файл Hosts и отредактировать в любом текстовом редакторе, поэтому подобный вариант может быть предпочтительнее вы ряде случаев.

    Чтобы открыть Hosts через Finder, нажмите в нижнем меню на Finder правой кнопкой мыши и выберите вариант “Переход к папке”.

    Откроется окно, в котором нужно ввести путь к папке, в которую вы хотите попасть. Вводите следующий адрес:

    /private/etc/hosts

    И жмите “Перейти”.

    Откроется системная папка, в которой находится файл Hosts. Чтобы приступить к его редактированию, нужно нажать на него правой кнопкой мыши и выбрать редактор, в котором вам удобнее работать (можно использовать и стандартный редактор - TextEdit).

    В открывшемся окне можно редактировать файл Hosts, как и любой другой файл в текстовом редакторе. Но при этом системный файл Hosts защищен от редактирования. После того как вы попробуете внести в него изменения, появится сообщения с предложением создать дубликат файла. Нажмите “Дублировать”, после чего на базе первого файла образуется второй.

    Далее останется внести необходимые изменения в новый созданный файл и сохранить его в удобном месте, например, на рабочем столе. При сохранении выбирайте разрешение.txt (такое же разрешение у оригинального файла Hosts). Когда сохраните новый файл, нужно будет им просто заменить старый файл в системной папке etc. Для этого перетащите новый файл в папку, где расположен старый Hosts и нажмите “Заменить” при появлении соответствующего сообщения. В результате этих действий старый файл Hosts будет удален, а новый система начнет использовать вместо него.

    Как применить изменения файла Hosts

    Некоторые изменения, которые вносятся в файл Hosts, не воспринимаются системой сразу и, соответственно, не действуют. Чтобы изменения вступили в силу, нужно обновить кэш DNS. Это можно сделать с помощью терминала, использовав в нем команду:

    Dscacheutil -flushcache; sudo killall -HUP mDNSResponder

    После выполнения данной команды файл Hosts будет прочитан системой повторно, и все изменения, которые были в него внесены, отразятся на работе компьютера.

    Справедливые, не завышенные и не заниженные. На сайте Сервиса должны быть цены. Обязательно! без "звездочек", понятно и подробно, где это технически возможно - максимально точные, итоговые.

    При наличии запчастей до 85% процентов сложных ремонтов можно завершить за 1-2 дня. На модульный ремонт нужно намного меньше времени. На сайте указана примерная продолжительность любого ремонта.

    Гарантия и ответственность

    Гарантию должны давать на любой ремонт. На сайте и в документах все описано. Гарантия это уверенность в своих силах и уважение к вам. Гарантия в 3-6 месяцев - это хорошо и достаточно. Она нужна для проверки качества и скрытых дефектов, которые нельзя обнаружить сразу. Видите честные и реальные сроки (не 3 года), вы можете быть уверены, что вам помогут.

    Половина успеха в ремонте Apple - это качество и надежность запчастей, поэтому хороший сервис работает с поставщиками на прямую, всегда есть несколько надежных каналов и свой склад с проверенными запчастями актуальных моделей, чтобы вам не пришлось тратить лишнее время.

    Бесплатная диагностика

    Это очень важно и уже стало правилом хорошего тона для сервисного центра. Диагностика - самая сложная и важная часть ремонта, но вы не должны платить за нее ни копейки, даже если вы не ремонтируете устройство по ее итогам.

    Ремонт в сервисе и доставка

    Хороший сервис ценит ваше время, поэтому предлагает бесплатную доставку. И по этой же причине ремонт выполняется только в мастерской сервисного центра: правильно и по технологии можно сделать только на подготовленном месте.

    Удобный график

    Если Сервис работает для вас, а не для себя, то он открыт всегда! абсолютно. График должен быть удобным, чтобы успеть до и после работы. Хороший сервис работает и в выходные, и в праздники. Мы ждем вас и работаем над вашими устройствами каждый день: 9:00 - 21:00

    Репутация профессионалов складывается из нескольких пунктов

    Возраст и опыт компании

    Надежный и опытный сервис знают давно.
    Если компания на рынке уже много лет, и она успела зарекомендовать себя как эксперта, к ней обращаются, о ней пишут, ее рекомендуют. Мы знаем о чем говорим, так как 98% поступающих устройств в СЦ восстанавливется.
    Нам доверяют и передают сложные случаи другие сервисные центры.

    Сколько мастеров по направлениям

    Если вас всегда ждет несколько инженеров по каждому виду техники, можете быть уверены:
    1. очереди не будет (или она будет минимальной) - вашим устройством займутся сразу.
    2. вы отдаете в ремонт Macbook эксперту именно в области ремонтов Mac. Он знает все секреты этих устройств

    Техническая грамотность

    Если вы задаете вопрос, специалист должен на него ответить максимально точно.
    Чтобы вы представляли, что именно вам нужно.
    Проблему постараются решить. В большинстве случаев по описанию можно понять, что случилось и как устранить неисправность.

    Один из самых распространённых вопросов касательно Windows - где находится hosts . В этой статье я расскажу о расположении этого файла в любой ОС, зачем он вообще нужен и для чего его редактируют. Обычно его ищут для того, чтобы исправить проблему с доступом к сайту или наоборот закрыть к нему доступ. В любом случае, в этой статье я расскажу вам не только где находится файл hosts в Windows 10, но и рассмотрю другие ОС, даже Linux,

    Hosts в Windows 10

    Обычно файл hosts в Windows находится в папке

    %windir%/system32/drivers/etc/

    Путь к ней можно вставить в проводник.


    Или открыть файл напрямую через команду выполнить (Win + R):

    %windir%/system32/drivers/etc/hosts
    Путь к файлу hosts

    В пути неслучайно указана переменная %windir% - она содержит в себе путь к папке Windows независимо от того, где она находится. Например, папка может называться . Независимо от разрядности системы, файл hosts всегда находится в одном и том же месте в Windows 10. Единственная проблема, с которой вы можете столкнуться - это запрет на редактирование файла. На этот случай рекомендую ознакомиться со статьей .

    Где находится файл в hosts windows 7

    Путь к файлу hosts в Windows 7 ничем не отличается от пути в других версий ОС Windows. Однако, на всякий случай я приведу здесь скриншоты как найти файл hosts в Windows 7 64 и 32 бита.


    Файл hosts в Windows 7

    Введите путь к файлу hosts %windir%/system32/drivers/etc/hosts и воспользуйтесь программой Блокнот, а ещё лучше установите Notepad++. В ней у вас не возникнет никаких проблем с правами.


    Ну и напоследок расскажу где находится файл в других операционных системах, отличных от семейства Windows.

    Hosts в Mac OS

    Возможно вам понадобится отредактировать файл hosts в MacOS X. Для того, чтобы это сделать, откройте программу «Терминал» и введите в ней команду:

    Sudo nano /private/etc/hosts

    Введите пароль и нажмите Enter. Перемещайтесь по файлу стрелками, внесите необходимые изменения и нажмите Ctrl + O для сохранения файла. Утвердительно ответьте на вопрос о сохранении. Либо нажмите Ctrl + X для выхода в терминал и утвердительно ответьте на вопрос о сохранении файла. После данной процедуры желательно .

    Кстати, в Linux файл hosts обычно находится по адресу /etc/hosts . Отредактировать его вы сможете таким же образом, как и MacOS - через редактор nano .

    Во всех системах Windows файл hosts всегда находится в одной и той же папке, об этом уже было сказано выше. Вы можете запомнить этот простой путь, скорее всего, вам придётся пользоваться этим не раз и не два. Лично мне очень часто приходится редактировать файл hosts и довольно удобно делать это не прибегая к помощи инструкции. Если у вас есть комментарии относительно этой статьи, поделитесь ими в форме ниже. Удачи!