How can I add 127.0.0.1 localhost to my etc/hosts file/

oxband

macrumors 6502
Original poster
Sep 10, 2009
304
2
So, for months and months, my computer, every 12 seconds or so in the console, shows this: rpc.lockd: can't contact statd, 100024 RPC: Unknown host

I want to resolve this. It cant be good.

Someone on the Apple Disccussion proposed this as a solution: "sounds kinda like loop back is missing from your etc/hosts file? Add 127.0.0.1 localhost if its not at the head of the file and see if it fixes the problem."

I want to try that but I have no idea how to. Can someone explain this to me?
 

MacUser2525

macrumors 68000
Mar 17, 2007
1,830
221
Canada
So, for months and months, my computer, every 12 seconds or so in the console, shows this: rpc.lockd: can't contact statd, 100024 RPC: Unknown host

I want to resolve this. It cant be good.

Someone on the Apple Disccussion proposed this as a solution: "sounds kinda like loop back is missing from your etc/hosts file? Add 127.0.0.1 localhost if its not at the head of the file and see if it fixes the problem."

I want to try that but I have no idea how to. Can someone explain this to me?
You would open Terminal.app (it is in the Utilities folder) then type in and hit enter key sudo nano /etc/hosts again type in then hit enter key your password when asked. The file will now open for editing where you can add the line you desire. To save and exit use the control and x keys at the same time confirming you wish to save the file when asked. My /etc/hosts as it by default from Apple in Mountain Lion for your reference.

Code:
MacUser2525:~$ cat /etc/hosts
##
# 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
 

benwiggy

macrumors 68020
Jun 15, 2012
2,186
15
If you are unfamiliar with the Terminal, I would recommend using the free text editor, TextWrangler for modifying system files.
It lets you browse hidden files in its open file dialog, and handles correct permissions/authorisation.

However, I am surprised that your hosts file got modified without your knowledge.
 

chown33

Moderator
Staff member
Aug 9, 2009
8,496
4,508
Restivus
The first step should be to look at your hosts file. If it's correct, then it doesn't need editing. This is the "Look before you leap" principle.

Copy and paste this exact command-line into a Terminal window:
Code:
cat /etc/hosts
Compare the output with the output posted in post #2.

If yours looks the same as what MacUser2525 posted, you don't need to edit or change anything, and the guess that was made in that Apple Discussion is wrong.

If yours doesn't look the same, then copy and paste the complete output from the Terminal window into a reply posted here.