Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Plazmotech

macrumors newbie
Original poster
Jul 17, 2012
10
0
I really despise XCode, but I have to use it because it's the easiest way of compiling SDL + C++ Code.

Anyhow, XCode is at it again, doing its usual shenanigans.

This time, I'm getting a 'invalid host string "localhost"' error. sigh

This happened to me once but I resolved it. I remember it took me like 3 days of trying to finally get it. But I just recently updated my XCode, and now it's happening again.

Whenever I try run my application, xcode gives me a 'invalid host string "localhost"'

Now, doing a search around the internet (like most times when it has to do with XCode) yields no correct results. They all say that either the hosts file is wrong, named incorrectly, or has a wrong extension. But nope.

My hosts file is under etc/hosts - It has no extension, it is named "hosts" not "host", and it looks like this:

Code:
##
# 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

I remember that when I solved it last time it did not have to do with the hosts file.

I really, really hate XCode.

Please help
 
For us to be able to help you're going to have to let go of some of the emotion and give us some facts:
Where is the error displayed? An XCode dialog box? The console? Post a screenshot.
What OS are you running?
What version of XCode are you running? What version were you running before you upgraded?
If you run the binary from the terminal rather than through XCode do you have this problem?
Are you just running or debugging?
Are you running a release or debug build?

-Lee
 
For us to be able to help you're going to have to let go of some of the emotion and give us some facts:
Where is the error displayed? An XCode dialog box? The console? Post a screenshot.
What OS are you running?
What version of XCode are you running? What version were you running before you upgraded?
If you run the binary from the terminal rather than through XCode do you have this problem?
Are you just running or debugging?
Are you running a release or debug build?

-Lee

Sorry, I was really frustrated. Here is what it looks like.

53aN5ni.png


I am running OS 10.8.5, before, I was running 10.8.4. I remember it took me a while to resolve the problem initially. Any code I run in XCode gives me this error, including the default Hello World. I have tried changing my hosts file (and obviously clearing the DNS cache), and yes, I've restarted my computer and XCode.

I have not used XCode since I updates to 10.8.5.
 
did you run

dscacheutil -flushcache

I also wonder if maybe when you edited the hosts file you saved it as a different format or something (unicode?) and it's screwing something up. that is easy to do if you cut+paste the file from the web, for example.

Try deleting it, and re-typing the file in by hand with textedit, or vi/nano
 
did you run

dscacheutil -flushcache

I also wonder if maybe when you edited the hosts file you saved it as a different format or something (unicode?) and it's screwing something up. that is easy to do if you cut+paste the file from the web, for example.

Try deleting it, and re-typing the file in by hand with textedit, or vi/nano

Naw, it's saved as plain text. And yes, I flushed the cache.
 
Are the permissions on /etc/hosts correct?

Such as:

Code:
-rw-r--r--   1 root  wheel     236 Mar 12  2013 hosts

You had this problem almost a year ago, what did you do to fix it then?

And it's really not Xcode, there is something misconfigured or set incorrectly in the OS itself that is causing this. Xcode is simply hitting the problem.

BTW I had some QA people for a certain three letter-named phone company using a MacBook for testing some of my stuff, which mind-boggingly shared a single stick of RAM with another MacBook (they were swapping it between the two obviously), had no localhost entry in the /etc/hosts file - because they had deleted it.

Nothing surprises me anymore.
 
I was running against the same problem on a run-time of xcode debug. Are you running gas mask? If so, I was simply under the remote file rather than the local in my settings.
 

Attachments

  • Screen Shot 2013-12-25 at 4.47.09 PM.png
    Screen Shot 2013-12-25 at 4.47.09 PM.png
    30.7 KB · Views: 572
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.