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.

Filter by
Sorted by
Tagged with
2
votes
1answer
49 views

Incorrect hostname in terminal after factory reset

I wiped out Mac and reinstalled (Mojave) (logout from Cloud, Messages, deauthorized iTunes, erase disk, reinstall). Now my terminal is showing a name that I set up through Preferences -> Sharing on ...
0
votes
0answers
17 views

How to make Chrome look for local DNS

MacOS Version: 10.14.5 Chrome Version: 75.0.3770.100 I have entered an entry in my /etc/hosts like below ## # Custom hosts ## 127.0.0.1 jupyter.dev ::1 jupyter.dev My traceroute ...
1
vote
1answer
39 views

hosts file: does it pass the domain name? I'm always redirected to the main site configured on the host

My NEW server IP address is 123.456.789.123. Pointing my browser to 123.456.789.123 (http://123.456.789.123) the server serves me site alpha. Now, on the same NEW server I've configured a second ...
1
vote
0answers
22 views

MacOS prefer /etc/hosts over DNS

My Mac is running dual stack IPv4/IPv6 which works fine. In my /etc/hosts I have added a IPv4 pointer to my development VM like so: website.test 10.10.10.35 This works fine. But I noticed that some ...
1
vote
1answer
39 views

/etc/hosts ignores some entries

Giving the command below shows my /etc/hosts all similarly formatted. Trying Safari to go to facebook.com indeed gives the URL: safari-resource:/ErrorPage.html but for some or many of the other ...
2
votes
2answers
401 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 ...
2
votes
4answers
5k 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
34 views

How can I make a process in macOS use a different hosts file without using a chroot jail?

Unlike Linux, we cannot use HOSTALIASES env var. I believe it is possible to make a process see a different hosts file if I put it in a chroot jail, but I don't want to have to do that for this ...
0
votes
1answer
54 views

How can I make macOS respect HOSTALIASES environment variable?

According to the Apple developer documentation, setting HOSTALIASES will make a process look in that file for hostnames instead of /etc/hosts. However when I tested this with ping and a replacement ...
1
vote
1answer
772 views

Error: “sudo: command not found” when trying to use XAMPP [closed]

I am trying to use XAMPP to create a server on my MacBook. I'm following the tutorial here: https://www.webucator.com/how-to/how-install-start-test-xampp-on-mac-osx.cfm and I'm stuck on the bit ...
0
votes
0answers
33 views

How to give myself permission to edit the locked hosts file on MacOS Mojave? [duplicate]

I am logged in with my admin account, which is my only account on this computer. I checked under preferences and it says "admin". I have located the file here: /private/etc/hosts When I go to ...
1
vote
1answer
35 views

What is 'currentHost' for, in defaults?

There are many webpages given over to listing defaults commands in order to configure various parts of the OS. Some of them include the flag -currentHost. The man page for the defaults command ...
2
votes
1answer
145 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 ...
12
votes
6answers
30k views

How to edit the /etc/hosts file?

When I open the file with TextEdit (I don't want (truly, I am not able) to use vim), it is seen as "locked", even if I modify the permissions of the file via the "Get Info" window. How can I modify ...
0
votes
0answers
673 views

How is iOS to host communication done with TCP to USB?

I am looking for a good primer on information about accessing the data streamed from iOS devices to a host via USB. I've found this is done through TCP, I think. But concrete info is what I'm looking ...
0
votes
1answer
1k 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$ ...
6
votes
3answers
15k 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: ...
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 ...
0
votes
1answer
845 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 ...
17
votes
5answers
102k views

Add a hosts file entry without jailbreaking

I have an iPad that needs to be able to connect to a server via its short hostname, e.g. http://app instead of http://app.example.com. The network it connects to assigns it a domain name other than ...
2
votes
2answers
157 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 ...
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 ...
0
votes
1answer
40 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"?
6
votes
2answers
12k 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
1answer
46 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
102 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 ...
0
votes
1answer
167 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
414 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 ...
2
votes
2answers
2k 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
718 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
239 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
441 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
2k 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 ...
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.
3
votes
1answer
124 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?
2
votes
1answer
652 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
568 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
7
votes
3answers
22k views

Cannot access localhost after upgrade to Mavericks but can access 127.0.0.1

I ran across this question, but it wasn't resolved (and it hasn't been touched in a while). I'm not sure if my issue is the same, but I don't have enough reputation here to comment on that question. ...
2
votes
5answers
4k views

How make changing to the /etc/hosts file take effect?

I added some lines to my /etc/hosts file to resolve a private hostname, but every time after rebooting, the lines I added get lost. Should there be any setting options to make these changes take ...
1
vote
1answer
531 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. ...
13
votes
1answer
15k 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
0answers
48 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 ...
1
vote
1answer
516 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 ...
1
vote
2answers
655 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 ...
6
votes
1answer
876 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. ...
-1
votes
3answers
4k 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
727 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 ...
16
votes
6answers
96k views

problem accessing localhost on Mac OS X Mavericks…it was working fine until I rebooted today

I am perplexed about the problem I am having and would really appreciate help resolving it. I have an iMac running Mac OS X Mavericks 10.9.2 I have set up my apache to serve documents from the ...
1
vote
3answers
2k views

Cannot use ssh/ping domain name after connecting to openvpn

I've got two macs, both on the same network, both using Tunnelblick to connect to vpn. Both with same settings. Both connect fine and both have the same settings for DNS and search domain applied ...
2
votes
2answers
56 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 ...