Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [hosts]

The hosts file, used to map hostnames to IP addresses. This tag is for questions relating to usage of this file, including reading and modifying its contents to change which IP a hostname is mapped to.

1
vote
1answer
589 views

Mojave Hosts File

Was there some new behavior around the /etc/hosts file in Mojave? Cannot get the thing to pick up any new entries which I make in the file. I am restarting the DNS resolver thingy, and I vetted my ...
0
votes
0answers
22 views

Apple TV's host name keeps counting up numbers

I've got an Apple TV gen 2 and it is connected to my network at home via wifi. The host name of the Apple TV has a counting number at the end of the name. It keeps getting bigger. It all started ...
2
votes
2answers
35 views

how to add ip routes with host name instead of ip address?

I want to add IP routes for host that I do not have the IP address for. I basically want tell macOS to search for a host in a specific interface: sudo route add -host <myHostname> -iface en7 ...
2
votes
0answers
73 views

OSX Sierra, trouble with virtual hosts

I'm trying to create a separate virtual host on a Mac for a local project, which would not be http://localhost/ibb but, for example: http://ibb.local. For this I carefully followed the next ...
1
vote
0answers
71 views

MAMP vhost just showing “It Works!”

After AMPPS started giving me issues after upgrading to high sierra, I decided to buy Mamp Pro. I can get to http://localhost:8888 just fine, but anytime I try one of my vhosts, I just get the ...
0
votes
1answer
29 views

How do I put an HTML page to be displayed when opening a website from hosts file?

Hosts file is blocking access to some websites. How do i put custom HTML instead of default message "This site can’t be reached"?
1
vote
0answers
426 views

Alternative to constantly editing hosts file

Every time I log into my work's VPN an automated script rewrites my hosts file, resetting it to some standard version that they manage. That only happens on Mac OS (I have a Windows laptop with the ...
1
vote
1answer
29 views

Hostfile not working for subdomain

I'm trying to setup custom A records for domains via /etc/hosts on my OSX 10.13.2 MBP. It usually works just fine, first time that it works only for 1 of the 2 domains: 1.2.3.4 dev.com (works; ...
2
votes
0answers
95 views

Before update to High Sierra httpd-vhosts.conf is empty

I just upgraded from Sierra to High Sierra. Apparently everything works fine. But when testing my works in local (Web developments in PHP, etc) I see that none works. Checking and looking for where ...
2
votes
0answers
72 views

my local development /etc/hosts redirect works only on chrome

I am confused why my host name in /etc/hosts works for Google Chrome only. Not on Safari, not on Firefox, not from command-line tools like curl. ## # Host Database # # localhost is used to configure ...
0
votes
1answer
613 views

Change hosts file does not have any effect

I have edited the /etc/hosts file on macOS 10.12.6. Then trying to flush the DNS services has no effect, why? Here is what I have done: cd /etc sudo cat hosts sudo cat -te hosts ##$ # Host Database$ ...
0
votes
1answer
84 views

Is it possible to use etc/hosts to block a specific part of a whole website

I know how to use etc/hosts to block something such as youtube.com However, I when I try to use etc/hosts to block something such as: youtube.com/user/TEDtalksDirector nothing seems to happen. Is it ...
0
votes
1answer
225 views

dns lookup specified in /etc/hosts and then dscacheutil != differ from dig, host, chrome

Via a long chain up of OS upgrades I'm running macOS Sierra 10.12.5. Setting entries in my /etc/hosts file is working only occasionally, mostly not. For example on a freshly rebooted machine. With ...
1
vote
2answers
903 views

How can I delete one of my devices from the “lists of known hosts (ECDSA)” after connecting to it with SSH?

How can I delete one of my devices from the "lists of known hosts (ECDSA)" after connecting to it with SSH on Sierra ?
2
votes
1answer
429 views

Protect hosts file

I am under the impression that there is no real way to protect the hosts file completely without creating a none-admin user account on my Mac and setting the password of the admin account to one that ...
0
votes
0answers
198 views

editing DNS rules locally in macOS 10.12

When I develop web sites I like to have them run locally and responding to a more useful name than localhost/site. It used to be you could write rules in hosts pointing to 127.0.0.1. It would seem you ...
0
votes
2answers
300 views

removed /etc/hosts on a mac and now can't sudo

I think I made a mistake by editing /etc/hosts within sublime text, because immediately afterward I was unable to run "sudo xxx". It would ask for a password, and then never resolve once I'd typed it ...
1
vote
1answer
1k views

File launches in Launchctl with PID - Status 1

I have a Python program that writes to the /etc/hosts file. It works correctly manually entered using the sudo command. I want it to open automatically. I can load it into sudo launchctl but it ...
3
votes
1answer
84 views

Danger in not maintaining known_hosts file?

I am not sure what all hosts I have accumulated over time under my ~/.ssh/known_hosts file are. Is there any risks in keeping all hosts' addresses or doesn't it make any difference?
3
votes
1answer
335 views

Editing/removing hostfile on jailed iPhone

So guys I've done a very silly thing. I've installed a tweak that blocks ad websites, but apparently it blocks every connection on the internet(things using DNS, but now all the things use it) I only ...
3
votes
1answer
386 views

How to block an app's access to a specific website using the hosts file?

I want to block an app from connecting to a specific website using the hosts file. How can I do that? Is something like this possible: 127.0.0.1 foo.com:spotify
0
votes
1answer
401 views

Mapping ::1 to 127.0.0.1

I am no expert in DNS or IPv6. I am using a brand new Mac with what seems to be the default: 127.0.0.1 localhost 255.255.255.255 broadcasthost ::1 localhost I have enabled Apache. ...
0
votes
0answers
37 views

how i can disable writing /etc/hosts file in MacOS

i got some problem, i want to disable [removing, deleting or writing a file] via administrator (sudo user) in MacOS. for example i want a create a some db of blocked websites without any web ...
10
votes
1answer
9k views

Cannot ping my local machine

I have just updated my Mac to macOS Sierra 10.12. My hostname is ninjaPixels-Macbook-Pro and if I run: ping ninjaPixels-Macbook-Pro.local or ping ninjaPixels-Macbook-Pro I get an error of unknown ...
0
votes
1answer
359 views

Why can I still access blocked sites in /etc/hosts?

I've been trying to setup launchd to block several websites on OS X 10.11.6 The /etc/hosts list is changed on schedule but a browser can still access the blocked sites. Another strange behavior is ...
3
votes
2answers
7k views

Local hostname is already in use on this network?

When I turned my computer on this morning this is the message I received: This computer's local hostname "----Macbook-pro.local" is already in use on this network. The name has been changed to "------...
1
vote
2answers
522 views

change permission /etc/hosts?

I'm getting into Vagrant and I installed a plugin that update my Mac's /etc/hosts to add a domain and map the IP address to the domain. The only problem that in order to change the file, it needs ...
2
votes
1answer
1k views

User specific host file

I would like to add a user specific host file on my Mac (El Capitan 10.11.5) to a users home directory and have this be checked in addition to /etc/hosts when resolving domain names. I found a ...
-1
votes
3answers
3k views

how to block youtube in the hosts file

I know how to block websites in the host file and it works with others, but with YouTube i just can't get it to work. What am I missing? 127.0.0.1 youtube.com 127.0.0.1 www.youtube.com
3
votes
2answers
566 views

Adding website to block via /etc/hosts not working

I block some websites via /etc/hosts on my machine. But for reddit.com it does not work. What does I have to do? ## # Host Database # # localhost is used to configure the loopback interface # when ...
3
votes
2answers
52 views

Where to insert a custom item in /etc/hosts file?

The default /etc/hosts file looks like this: 127.0.0.1 localhost 255.255.255.255 broadcasthost ::1 localhost fe80::1%lo0 localhost If I want to insert a custom item, should I insert it after the ...
1
vote
1answer
1k views

Blocking an IP address

I need to block a particular website on my Mac (OSX 10.11.1, El Capitan). I have already made the changes to /etc/hosts but the website is still not blocked when testing from Chrome. I think this has ...
2
votes
3answers
2k views

How can I force Google SafeSearch on my kids' Mac?

I'm pretty sure there's a way to force enable Google Safe Search by editing a hosts file on my kids' Mac. Can someone tell me how? I'm guessing I need to sudo nano /etc/hosts According to How to: ...
0
votes
1answer
735 views

Why is there a hosts.equiv file in my /etc folder?

I'm running OS 10.11.1 on my Macbook Pro. I should also preface my question with the admission that my knowledge of the Mac OS is practically zero. I was looking at (not editing) the hosts file in ...
0
votes
2answers
289 views

Keyboard Maestro: How to write to /etc/hosts file

So I have been using an app called Self Control to block certain sites globally on my machine so I'm not distracted when I work. The method this program uses is edit your /etc/hosts file and redirect ...
0
votes
1answer
183 views

xampp + mac os x issues

just installed XAMPP and have tried setting up a local server but the address won't resolve. It will lead to a "Connection Was Reset" error. I tried looking in the logs but none were present so I'm ...
0
votes
2answers
447 views

What happens if I edit a duplicate Hosts file?

What exactly is a duplicate file? When I wanted to edit the hosts file (/private/etc/hosts), it says: You don't own the file "hosts" and don’t have permission to write to it. You can ...
6
votes
3answers
11k views

/etc/hosts will not update/refresh at all

I add to my /etc/hosts file this : 127.0.0.1 youtube.com Save the file. Flush everything with : dscacheutil -flushcache; sudo killall -HUP mDNSResponder Reboot my computer 30 times. Then I run: ...
-1
votes
0answers
45 views

Terminal Command to Edit Hostname [duplicate]

How can I edit the Hostname of my MacBook Pro via the CLI? Currently running Mac OS X Yosemite (Version 10.10.5).
1
vote
1answer
2k views

How to edit hosts with TextEdit on Yosemite?

This line used to work sudo -b "/Applications/Textedit.app/Contents/MacOS/TextEdit" /etc/hosts But on Yosemite, it does not work anymore.
1
vote
0answers
75 views

OSX etc/hosts not blocking one particular site

I've used etc/hosts to block a lot of sites without issue, however I'm trying to add in filterbypass.me to the list but it won't work. I've tried adding: filterbypass.me as well as all the http/https/...
3
votes
1answer
575 views

Hosts file being reset after every reboot

My /private/etc/hosts file is being reset after every reboot. I can make my changes, save the file, and it will work. Right up until I reboot my Mac. Has anyone found a work around for this or a way ...
1
vote
1answer
3k views

What happens if I remove the localhost address from /etc/hosts

I have looked at the hosts file before but never thought of this. The hosts file overrides the DNS addresses so it can be used to forward sites or to block them. When looking at the file, the default ...
0
votes
1answer
1k views

Ping respects hosts overrides - but browsers don't, in spite of DNS cache flushes

I have a baffling problem. Browsers on my system (10.10.3 Yosemite) don't respect overrides included in my hosts file. This includes Chrome, Safari, and Firefox. I have tried rebooting, clearing ...
6
votes
1answer
811 views

What are these google host entries that keep showing up automatically in my etc/hosts file?

I went to edit my /etc/hosts file and found a bunch of entries for google urls that I never put there. When I try to delete it, it just comes back. I tried searching google for it but to no avail. ...
3
votes
2answers
2k views

Mac OS X Mavericks DNS name lookup order change?

I noticed Mavericks prefers the DNS server to /etc/hosts (scutil --dns). There used to be a good 'ol "order hosts,bind". Is there anything equivalent for Mavericks so my hosts file is consulted before ...
3
votes
1answer
1k views

Multiple .local hostname on one computer

Is possible setup multiple .local hostname on one physical computer? Background: home network (behind the DSL/NAT router) (192.168.1.*) have a mac-mini, called as "tango.local". (set in the System....
1
vote
1answer
208 views

I Would Like To Host an HTML Website Without Using Server.app

I am somewhat a novice when it comes to the Apache web server. I currently host Ruby on Rails applications on my Mac Mini Server (Mavericks) using Phusion Passenger. I know that some of the config ...
4
votes
5answers
24k views

why cannot I edit my `hosts` file?

I'm trying to edit my hosts file, because doing ssh <some host in hosts> fails to translate to ip. according to the Finder UI it is found under: however when trying to run cat hosts from the ...
1
vote
3answers
15k views

How to edit the hosts to block IP address?

I know how to block certain website, like if I want to block google I can use this line in the host 0.0.0.0 www.google.com.hk www.google.com.hk But my question is how can I block certain IP ...