XCode at it *again*: invalid host string: 'localhost'

Discussion in 'Mac Programming' started by Plazmotech, Sep 25, 2013.

  1. Plazmotech macrumors newbie

    Joined:
    Jul 17, 2012
    #1
    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
     
  2. lee1210 macrumors 68040

    lee1210

    Joined:
    Jan 10, 2005
    Location:
    Dallas, TX
    #2
    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
     
  3. xStep macrumors 68000

    Joined:
    Jan 28, 2003
    Location:
    Less lost in L.A.
    #3
    Also, what have you tried to resolve the problem? Anything like restarting Xcode to rebooting the machine.
     
  4. Plazmotech thread starter macrumors newbie

    Joined:
    Jul 17, 2012
    #4
    Sorry, I was really frustrated. Here is what it looks like.

    [​IMG]

    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.
     
  5. robvas macrumors 68020

    Joined:
    Mar 29, 2009
    Location:
    USA
    #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
     
  6. Plazmotech thread starter macrumors newbie

    Joined:
    Jul 17, 2012
    #6
    Naw, it's saved as plain text. And yes, I flushed the cache.
     
  7. ExitToShell macrumors newbie

    Joined:
    Sep 21, 2013
    #7
    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.
     
  8. oneintheword macrumors newbie

    Joined:
    Mar 31, 2010
    #8
    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.
     

    Attached Files:

Share This Page