Host File Set-up

Joined
Mar 24, 2010
Messages
6
Reaction score
0
Points
1
I am working with a web designer on a new website for our company. At work, we use PC. The web company has essentially "hidden" the sight from the public but we can access it and edit content. In order to access the site on our PC, we had to go in to "run command" and edit the "ETC/HOSTS" file as follows (the following is a fake site is for security reasons):
55.40.127.6 www.fakewebsite.com

The web designer does not use Mac and are not sure how to set it up. Can anyone help?

Thanks in advance!
 

vansmith

Senior Member
Joined
Oct 19, 2008
Messages
19,924
Reaction score
559
Points
113
Location
Queensland
Your Mac's Specs
Mini (2014, 2018, 2020), MBA (2020), iPad Pro (2018), iPhone 13 Pro Max, Watch (S6)
The hosts file on a Mac is at /etc/hosts. Open up a Terminal (/Applications/Utilities) and enter the following:
Code:
sudo nano /etc/hosts
Enter your password and edit as necessary. Use Ctrl-O to save and Ctrl-X to exit.
 
OP
S
Joined
Mar 24, 2010
Messages
6
Reaction score
0
Points
1
Further Question

The hosts file on a Mac is at /etc/hosts. Open up a Terminal (/Applications/Utilities) and enter the following:
Code:
sudo nano /etc/hosts
Enter your password and edit as necessary. Use Ctrl-O to save and Ctrl-X to exit.

Thanks for your response. I have tried that and can't seem to get it to work. Do I enter it all on one line?


Thanks again
 

vansmith

Senior Member
Joined
Oct 19, 2008
Messages
19,924
Reaction score
559
Points
113
Location
Queensland
Your Mac's Specs
Mini (2014, 2018, 2020), MBA (2020), iPad Pro (2018), iPhone 13 Pro Max, Watch (S6)
Flush the DNS cache to have the changes take effect:
Code:
dscacheutil -flushcache
 
OP
S
Joined
Mar 24, 2010
Messages
6
Reaction score
0
Points
1
Any Other Suggestions?

I have tried both, the entry and the cache clearing but neither seems to work. Any other suggestions?
 
Joined
Jul 2, 2007
Messages
3,494
Reaction score
204
Points
63
Location
Going Galt...
Your Mac's Specs
MacBookAir5,2:10.13.6-iMac18,3:10.13.6-iPhone9,3:11.4.1
Are you usually able to access the site from inside you company's network AND outside your company's network? It's possible you may need to be VPN'ed into your company's network to access the site in it's current state. You may wish to try pinging it to see if it's accessible from wherever you are located with your Mac. You might also run an "nslookup dotted.ip.address.com" to see if it shows up as you would expect it to. If those check out, you just need the hosts entry.
cd /etc
sudo cp -p hosts hosts.bak
vi hosts
(arrow down past the entries below, do not include the quotes around the commands)
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
fe80::1%lo0 localhost

add your line down here by hitting the "i" key
xxx.xxx.xxx.xxx <hit tab key> hostname <hit tab key> #Optional comment about the entry <hit enter key>
to exit vi hit the "esc" key then type ":wq!"

If OS X is anything like big steel Unix, the system will hit the /etc/hosts file before messing with DNS servers for an address/hostname designation.
 

Shop Amazon


Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.
Top