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
0 votes
1 answer
342 views

Can't edit hosts file on macOS 13.5 (sudo not working)

I don't have permission to edit the hosts file, even if I use sudo and turn off SIP. I use sudo vim /etc/hosts to open the hosts file. After entering :wq!, it shows: "hosts" E212: Can't open ...
SimpleMaxR's user avatar
1 vote
0 answers
111 views

Iphone doesn't apply changes in the hosts file

I decided do jailbreak Iphone 6s ios 15.2 For my device, only the semi-tethered jailbreak from palera1n was suitable. After palera1n icon appeared, I decided change: /private/etc/hosts file using ...
allon925's user avatar
0 votes
1 answer
71 views

Where is `HOST` being set to `x86_64-apple-darwin13.4.0`

This is the last line of my .zshrc: export HOST="localhost" How is this happening? ❯ source ~/.zshrc ❯ echo $HOST x86_64-apple-darwin13.4.0
chaimp's user avatar
  • 283
0 votes
0 answers
36 views

Persisting old name of Mac during file transfer

I'm using macOS Ventura 13.4.1. Before migrating to my current Mac desktop, I changed the name of its predecessor from "MyMac" to "MyMacOLD" and then did the migration from ...
murray's user avatar
  • 165
0 votes
3 answers
2k views

Can't make any change of hosts file on Mac OS ventura

Ask for support! I plan to add some records into hosts file under /etc/hosts. but when I try to change the file, I got error. unable to write a readonly file. I even use the root account to try to ...
Levy K's user avatar
  • 1
1 vote
1 answer
2k views

/etc/hosts changes aren't getting reflected on Mac

I've a Spring Boot application which uses an external service. I want to reproduce a scenario where that service is not reachable after my application is up and running. So, I thought I'll start my ...
Shivshankar Nagarsoge's user avatar
1 vote
0 answers
17 views

Can't Block a Website using Host File (Only Safari)? [duplicate]

I'm trying to block this website: www.blackhatworld.com using the host file. The lines I use are this one: 127.0.0.1 website.com www.website.com ::1 website.com www.website.com For some reason, this ...
Alex's user avatar
  • 469
1 vote
1 answer
1k views

Block Parallels Desktop from connecting to domain without using `/etc/hosts`

I have the following lines in my /etc/hosts. Parallels Desktop keeps commenting lines which as it needs to connect to that domain. I tried changing access of /etc/hosts to 444 but it suddenly changed ...
Parsa Noori's user avatar
1 vote
0 answers
32 views

Why does my Mac Pro's hostname keep changing to 'HUAWEI_Y6_2019-...'? [duplicate]

My MacBook Pro (running BigSur 11.2.1) now - since I rebooted it last night - keeps showing the host name as 'HUAWEI_Y6_2019-{hhhhhhhhhh}' in the bash prompt. (The hh's are a 10-digit hex string.) ...
Paul's user avatar
  • 111
0 votes
0 answers
189 views

Permission denied when changing hosts file on M1 mac

The error is PermissionError: [Errno 13] Permission denied: '/etc/hosts' Got the program to work on my own mac, but it doesn't work on my girlfriend's machine. The problem lies with this part when ...
Raphael Quiñones's user avatar
0 votes
1 answer
327 views

SelfControl and hosts file failing to block one particular website in safari

I'm having an issue with the app SelfControl not blocking one website, namely Chess.com. It seems to block everything else just fine. I tried entering the domain into my hosts file in terminal as well,...
Rob the Armadillo's user avatar
1 vote
1 answer
690 views

LaraDock virtual host not working on macOS Monterey Apache2

I have read many posts on the subject but none refers to exactly the same environment I have (macOS Monterey). So what I have done so far... I have successfully installed the latest versions of ...
Paul Godard's user avatar
1 vote
1 answer
28 views

Host certain folder for public access via URL

Hopefully I describe this in the way it can help me. Is it possible for me to host a drive live on a website of mine, in which users anywhere, (not just my network), can access to watch/listen/play ...
rxveri's user avatar
  • 11
2 votes
2 answers
2k views

After upgrade from Big Sur 11.2 to Monterey 12.1 Safari ignores HOSTS

For over 10 years I have been using the HOSTS file to block ads and other nasties on both macOS and Windows PCs. (Refer: https://winhelp2002.mvps.org/hosts.htm) It has worked flawlessly, until the ...
Thunderclutch's user avatar
1 vote
1 answer
386 views

Cannot block site z1.fm from etc hosts

When I try to block some websites on terminal by editing a bad address int /etc/hosts file it works in safari. But when I try to do it with z1.fm, it doesn't. When you type the website on internet, it ...
kamran1124's user avatar
0 votes
0 answers
172 views

How do I give PyCharm access to my /private/etc/hosts file?

How do I give PyCharm access to this file?
Richard Ijitola's user avatar
1 vote
1 answer
1k views

Some sites not blocked, /etc/hosts

macOS layman here, I'm trying to block websites natively with mixed results through Terminal using sudo nano /etc/hosts My syntax is 127.0.0.1 www.website.org ::1 www.website.org I've tried various ...
Alex's user avatar
  • 11
0 votes
1 answer
748 views

Command for resolving ip address for host entry in /etc/hosts?

I'm looking for a command that will let me resolve a host name in /etc/hosts to its corresponding IP address. nslookup ignores entries in /etc/hosts file. ping will find entries in /etc/hosts but is ...
StevieD's user avatar
  • 1,458
1 vote
0 answers
108 views

Cannot block some websites in macOS Safari

I cannot block some websites in Safari using the etc/hosts trick. Some websites are blocked, but not all. For example lichess.org and youtube.com aren't getting blocked in Safari (but they are ...
honkskillet's user avatar
0 votes
0 answers
987 views

HOSTS file & Little Snitch

LS 3.8.2, MacOS 10.13.6 (I'm in 'music', slowly updating). It's great having the option to modify the HOSTS file, but with Little Snitch installed it is not read. (I know the hosts file is not read ...
cheakypawl's user avatar
2 votes
1 answer
71 views

How can I log edits to the hosts file?

A guy I'm helping fix his Mac and he's got some process on there editing his host file to redirect queries to the Minecraft authentication servers (authserver.mojang.com and sessionserver.mojang.com) ...
Southpaw1496's user avatar
2 votes
1 answer
2k views

/etc/hosts entries blocking annoying game site (slither.io) in Chrome & Firefox, but not Safari

My lower school-aged son is now home schooling due to the SF Bay Area's COVID-19 school closures. He uses a 2018 MacBook Air with Catalina to complete assignments in web-based learning tools, and I ...
RightFullRudder's user avatar
1 vote
0 answers
2k views

Why this message "Local hostname is already in use on this network" for the 4th time?

Unlike this question Local hostname is already in use on this network? my computer was already turned on but 'closed' and when I opened it today I received this message: This computer's local ...
user339473's user avatar
2 votes
1 answer
62 views

Not able to resolve my domain name on browser

I am using docker for application and modified the hosts file and added domain name on local browser. I added in hosts: 127.0.0.1 xyz.com but when I am trying to open from browser getting the ...
Sikander's user avatar
  • 123
1 vote
1 answer
4k views

Block youtube on safari in hosts file

When I try to block websites on terminal (etc hosts..) it works. But when I try to do it with Youtube, it doesn't. Typing youtube.com as a url won't open it, but if I search youtube on google for ...
kamran1124's user avatar
4 votes
1 answer
2k views

Route with /etc/hosts on computer to computer network

Is it possible to change the /etc/hosts file so that the routing is used when a peer to peer network is created, for example, in my /etc/hosts file, I have thisismylaptop.com mapped to 127.0.0.1: 127....
will's user avatar
  • 53
3 votes
1 answer
758 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 ...
Kathy's user avatar
  • 31
1 vote
1 answer
64 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 ...
Aerendir's user avatar
  • 111
1 vote
1 answer
529 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 ...
Julius Baer's user avatar
0 votes
0 answers
260 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 ...
Andrew's user avatar
  • 497
0 votes
1 answer
984 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 ...
Andrew's user avatar
  • 497
1 vote
1 answer
4k 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 ...
user8981199's user avatar
0 votes
0 answers
72 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 ...
user1721135's user avatar
4 votes
2 answers
739 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 ...
benwiggy's user avatar
  • 33.7k
2 votes
4 answers
8k 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 ...
Randy L's user avatar
  • 262
2 votes
3 answers
12k 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 ...
WalterBeiter's user avatar
2 votes
2 answers
860 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 ...
Winteriscoming's user avatar
0 votes
1 answer
270 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"?
user208958's user avatar
1 vote
1 answer
71 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; ...
pycvalade's user avatar
  • 121
2 votes
0 answers
110 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 ...
Javier's user avatar
  • 121
2 votes
1 answer
407 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 ...
andilabs's user avatar
  • 789
0 votes
1 answer
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$ ...
Mike's user avatar
  • 101
0 votes
1 answer
384 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 ...
Foobar's user avatar
  • 155
0 votes
1 answer
971 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 ...
Ben Hyde's user avatar
  • 319
2 votes
2 answers
19k 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 ?
MFJC's user avatar
  • 420
7 votes
1 answer
6k 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 ...
user avatar
0 votes
0 answers
347 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 ...
MiB's user avatar
  • 480
0 votes
2 answers
1k 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 ...
Jeremy Smith's user avatar
2 votes
1 answer
5k 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 ...
epictrojan's user avatar
4 votes
1 answer
348 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?
Christopher Reyes's user avatar