Cannot ping localhost
Maybe your host file got mangled. Open a terminal, and read your hosts file:

vim /private/etc/hosts


This should contain a line that maps localhost to 127.0.0.1:

127.0.0.1   localhost


It could be this file does not exist at all, or the line I gave above is not present. To be able to edit it you need to be superuser, i.e.:

sudo vim /private/etc/hosts


or you can use any other editor besides vim.