osx - Hosts file missing on Mac OS X - Xcode Failing to compile code -


i've tried run first objective-c code in xcode... compilation process successfully, error returns " invalid host string: 'localhost' ".

after googling, found out , connected points might had hosts file deleted.

now cannot recreate /etc/hosts through terminal using:

sudo cat >/etc/hosts <

#

host database

#

localhost used configure loopback interface

when system booting. not change entry.

#

127.0.0.1 localhost 255.255.255.255 broadcasthost ::1 localhost fe80::1%1o0 localhost eod sudo: /private/etc/sudoers mode 0666, should 0440

thanks in advance workaround.

you have broken system making inappropriate changes.

first, need fix permissions on /etc/sudoers. might try opening disk utility, selecting system volume, , clicking repair disk permissions. not sure change sudoers permissions. if not, reboot system , press , hold command , s keys. boots single-user mode. when command prompt appears, enter these commands:

mount -uw / chmod 0666 /etc/sudoers reboot 

when system boots, sudo command might working again, if have not otherwise broken it. @ point, may able recreate /etc/hosts. in addition restoring contents, may need set ownership , permissions:

sudo chown root:wheel /etc/hosts sudo chmod u=rw,go=r /etc/hosts 

you restore /etc/hosts while in single-user mode, rather booting , using sudo command. before reboot command, use cat (or cp copy file prepared previously) recreate /etc/hosts, execute chown , chmod commands (without sudo), reboot.

i cannot guarantee these commands suffice or there no errors; diagnosing problems such remotely troublesome.

stop tinkering system without making backups know work or taking other steps able revert changes.


Comments

Popular posts from this blog

Change php variable from jquery value using ajax (same page) -

How can I fetch data from a web server in an android application? -

jquery - How can I dynamically add a browser tab? -