We’re rewarding the question askers & reputations are being recalculated! Read more.

Hot answers tagged

4

The man page that you referenced is very old (ancient) - it's from 1995. Looking at the man page for gethostbyname on a machine running El Capitan (2006), that reference is no longer there meaning it's a very good indication that what you are looking for has been deprecated.


3

As stated, it's pretty difficult to do this. However, if you're willing to change the goal a little, and use a name ending in ".local" instead of ".com", it's trivial (in fact, it's already being done for you). Let me start with a little networking theory. I think you're mixing up two different levels: name resolution and routing. Name resolution is how ...


1

If you are modifying /etc/hosts in the Docker container itself, then only processes within the Docker container are going to be able to resolve that domain locally. Thus, if you are using a browser on your Mac to access a port exposed by Docker, it knows nothing about the DNS override and will try to hit the real site -- which likely explains the message ...


1

Edit your hosts file: sudo vi /etc/hosts Add URLs you want to block. This should be sufficient: # Block YouTube 127.0.0.1 youtube.com 127.0.0.1 www.youtube.com 127.0.0.1 youtu.be 127.0.0.1 www.youtu.be 127.0.0.1 youtube-nocookie.com 127.0.0.1 www.youtube-nocookie.com Reset the Directory Service cache dscacheutil -flushcache Ping the the hosts for ...


1

1.) red-panda is your current computer name. Click Apple Menu on Top Left Open the System Preferences... App Type Computer Name in Search Change the red-panda to whatever you like, I would suggest something short, like KM, if you plan to use Terminal a lot Close System Preferences... App To securely wipe your hard drive, do an after-restart system ...


1

Your reasoning about the hosts file is actually not how it works. The hosts file is only responsible for providing a mapping from the hostname (alpha.com) to an IP - it doesn't have any influence on which hostname the browser sends to the webserver for virtual hosting. If you do actually end up on the new server, you have an error in your web server ...


1

Have you ruled out JavaScript in the web browser that tries several resolutions? I’m thinking making hosts entries won’t cut the mustard and most people will need something more strong like a custom DNS server to help escalate this game of whack-a-mole https://pi-hole.net/ Pi Hole is my current favorite DNS sinkhole these days and simplifies our efforts ...


1

In the case of networked accounts and networked home folders, a user can login to any Mac on for example a company network and see their own files and have their own preferences set. This is the case where you can use the -host feature. Say that you want for example one wallpaper on your own desktop, but another when you login to the shared office Mac in ...


1

If you have mapping for multiple domains in single line that might not work. 1.2.3.4 example.com www.example.com try splitting in to two lines 1.2.3.4 example.com 1.2.3.4 www.example.com Thanks,


1

/etc/hosts 127.0.0.1 localhost ibb.local I've had a similar issue on my mac a while ago, and nothing past the first declaration per IP was active. Listing all domain names that need to route to 127.0.0.1 on the same line addressed the issue. Unless something is sneakily misspelled, your config looks OK otherwise. (And I also used something**.local** and ...


1

I think I just found the answer to this problem. If you are working on a virtual machine, as I am, and you change the /etc/hosts file in your virtual linux machine, only chrome will detect that. You will need to change the hosts file in windows (c:\windows\system32\drivers\etc\hosts) in order to force firefox to check the table. The moment I change that file,...


Only top voted, non community-wiki answers of a minimum length are eligible