Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

OS X Mountain Lion - failing to resolve localhost

I was installing "unusual" software for a macbook - a full ERP system that includes web portals for field personnel. Everything was going along hunky dory (relatively) till, in launching the web portal, I recieved an error that seemed to be a users permission issue:


User uploaded file

I had no .rhosts file, so I created one with the suggested information in the top directory for my user (/users/dons/). This not only did not work but the local apache website no longer displayed:


User uploaded file


Here are my ping attempts, first by name:


Last login: Wed May 15 21:37:32 on ttys000

Donalds-MacBook-Air:~ dons$ ping localhost

ping: cannot resolve localhost: Unknown host

Donalds-MacBook-Air:~ dons$


Here's the ping by ip:


Donalds-MacBook-Air:~ dons$ ping 127.0.0.1

PING 127.0.0.1 (127.0.0.1): 56 data bytes

64 bytes from 127.0.0.1: icmp_seq=0 ttl=64 time=0.053 ms

64 bytes from 127.0.0.1: icmp_seq=1 ttl=64 time=0.171 ms

64 bytes from 127.0.0.1: icmp_seq=2 ttl=64 time=0.126 ms

64 bytes from 127.0.0.1: icmp_seq=3 ttl=64 time=0.182 ms

^C

--- 127.0.0.1 ping statistics ---

4 packets transmitted, 4 packets received, 0.0% packet loss

round-trip min/avg/max/stddev = 0.053/0.133/0.182/0.051 ms

Donalds-MacBook-Air:~ dons$


Here's my hosts file:


User uploaded file


At this point I have:

  • Removed the .rhosts file
  • Restored the hosts.equiv to blank
  • Performed a safe boot - same problem
  • Reinstalled OS X - same problem.


The major programs I've installed are Java 7, Eclipse, Perforce. This might not be anything, but on startup I get a terminal screen that shows the following:


Donalds-MacBook-Air:etc dons$ /System/Library/Frameworks/JavaVM.framework/Versions/A/Commands/java

Usage: java [-options] class [args...]

(to execute a class)

or java [-options] -jar jarfile [args...]

(to execute a jar file)

where options include:

-d32 use a 32-bit data model if available

-d64 use a 64-bit data model if available

-server to select the "server" VM

The default VM is server,

because you are running on a server-class machine.


-cp <class search path of directories and zip/jar files>

-classpath <class search path of directories and zip/jar files>

A : separated list of directories, JAR archives,

and ZIP archives to search for class files.

-D<name>=<value>

set a system property

-verbose:[class|gc|jni]

enable verbose output

-version print product version and exit

-version:<value>

require the specified version to run

-showversion print product version and continue

-jre-restrict-search | -no-jre-restrict-search

include/exclude user private JREs in the version search

-? -help print this help message

-X print help on non-standard options

-ea[:<packagename>...|:<classname>]

-enableassertions[:<packagename>...|:<classname>]

enable assertions with specified granularity

-da[:<packagename>...|:<classname>]

-disableassertions[:<packagename>...|:<classname>]

disable assertions with specified granularity

-esa | -enablesystemassertions

enable system assertions

-dsa | -disablesystemassertions

disable system assertions

-agentlib:<libname>[=<options>]

load native agent library <libname>, e.g. -agentlib:hprof

see also, -agentlib:jdwp=help and -agentlib:hprof=help

-agentpath:<pathname>[=<options>]

load native agent library by full pathname

-javaagent:<jarpath>[=<options>]

load Java programming language agent, see java.lang.instrument

-splash:<imagepath>

show splash screen with specified image

See http://www.oracle.com/technetwork/java/javase/documentation/index.html for more details.


As I said at this point, I've already reinstalled the operating system. The above error points me to a java problem (that and I no longer have a java icon on my system preferences), so I'm going to reinstall that first. If that doesn't work, I'm guess I'm going to have to erase the disk and go back to a factory reinstall.


Any helpful thoughts, directions or words of encouragement will be greatly appreciate.


Don Scattergood

MacBook Air, OS X Mountain Lion (10.8.3), Java 7

Posted on May 16, 2013 7:15 AM

Reply
8 replies

May 16, 2013 9:40 AM in response to TheDonOfLGI

Run Console.app in an admin account and search for "dns".


Also, Linc is on to something. I saw that you were using nano to edit /etc/hosts and I didn't think much about it. When I look more closely, I see that nano is complaining about an old-school Mac text file. What else did you edit /etc/hosts with?


I suggest copying /etc/hosts to some other location, editing it with TextWranger to fix the line endings to make them UNIX again, and use sudo to put the file back into place. See if that helps.

OS X Mountain Lion - failing to resolve localhost

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.