I seriously hope someone sees this and can help as quickly as possible. The Mac in question is a laptop my friend normally turns off after a few hours (especially at night), and we are afraid if we turn it off, it won't come back on during the next boot up.
We're working on a new website. The hosting company instructed us to edit the hosts file so we could keep the site hidden from the public while we work on it.
To do so, all we needed to do was add the IP address and domain to the hosts file. I had no problem doing this on my windows OS machine, but neither of us knew how to do it on a Mac, so I found and copied all the instructions from a tutorial on the hosting company's website. I went this route:
Applications > Utilities > Terminal
Once in the hosts file (it read "-- bash--80x24" across the top), I entered:
sudo nano /private/etc/hosts
At this point, we needed to enter his password, which he did.
My instructions said to "...edit the hosts file, appending your new mappings underneath the default ones".
That's where I ran into problems. Being unfamiliar with Macs, it never occurred to me to use the arrow keys to get the cursor "underneath" the defaults. Just clicking didn't work and tried to add any typing to the top line. The instructions failed to include that, and it was essential.
We called Apple support. Two different techs sounded fairly upset that we were in the hosts file, trying to make changes, even when I explained it was simply to add the hosting site IP and our domain name. Finally, one had me go about it a totally different way, than through Terminal.
I created a copy of the file (same name), saved to the desk top, then sent the original to the Trash. Next, I amended the copy and dragged it into the /etc directory. He also walked me through flushing the cache, as per the hosting site instructions. (dscacheutil -flushcache)
The website was still not accessible to my friend's computer, but since we'd "fixed" the hosts file, or so we thought, I said we'd take it up with the hosting support personnel and call him back if there were problems. We even rebooted, once.
I thought, before we get into chat with the host site's techs, I'd check the hosts file again and make sure my amendments were still there. I went the same route, Applications > Utilities > Terminal and entered the sudo info, knowing I wouldn't make any changes again.
The file was empty. Stone cold, empty. Nothing. We immediately retrieved the original from the Trash and put it on the desktop. The name at the top of this file's window is Hosts -- Locked.
The newly created file let me add the IP/domain info, but the Password request was no longer a popup, but one line in the hosts file window. Of course, it typed in invisibly, but once we hit Enter, I could type in the window. I typed all of the info from the orig into the newly created file and tried to save it via CTRL-O. A small black bar appeared at the bottom of that window, asking (something like): Name file to write: /etc/hosts
I needed it to be named exactly that, but CTRL-G (? I think) for Get Help, said it couldn't use the same name. I clicked to close, thinking it would ask me if I wanted to save the changes, but it didn't. Just closed. Subsequently, reopening the file again showed it was again empty.
Finally!! My questions:
1. How do I get the original hosts file back into the /etc directory?
2. Does the Mac Trash have a feature like the Windows Recycle Bin that lets you choose to restore the file to it's original location?
3. Now that Hosts -- Locked is no longer in the Trash, will the machine be able to access it as needed during reboot looping?
4. Will my friend's computer start up properly if it has a blank/empty hosts file?
It's killing me that I cannot talk to anyone at Apple because I do not own an Apple computer and don't have a serial number, but I DO have a Mac related issue. Any help you can give me on this would be GREATLY appreciated. And, yeah, I did mean to shout. Thank you so much.
----------
Sorry. I don't know much about it, but it's a Macbook Pro, OS-X, Lion. I hope that helps.
We're working on a new website. The hosting company instructed us to edit the hosts file so we could keep the site hidden from the public while we work on it.
To do so, all we needed to do was add the IP address and domain to the hosts file. I had no problem doing this on my windows OS machine, but neither of us knew how to do it on a Mac, so I found and copied all the instructions from a tutorial on the hosting company's website. I went this route:
Applications > Utilities > Terminal
Once in the hosts file (it read "-- bash--80x24" across the top), I entered:
sudo nano /private/etc/hosts
At this point, we needed to enter his password, which he did.
My instructions said to "...edit the hosts file, appending your new mappings underneath the default ones".
That's where I ran into problems. Being unfamiliar with Macs, it never occurred to me to use the arrow keys to get the cursor "underneath" the defaults. Just clicking didn't work and tried to add any typing to the top line. The instructions failed to include that, and it was essential.
We called Apple support. Two different techs sounded fairly upset that we were in the hosts file, trying to make changes, even when I explained it was simply to add the hosting site IP and our domain name. Finally, one had me go about it a totally different way, than through Terminal.
I created a copy of the file (same name), saved to the desk top, then sent the original to the Trash. Next, I amended the copy and dragged it into the /etc directory. He also walked me through flushing the cache, as per the hosting site instructions. (dscacheutil -flushcache)
The website was still not accessible to my friend's computer, but since we'd "fixed" the hosts file, or so we thought, I said we'd take it up with the hosting support personnel and call him back if there were problems. We even rebooted, once.
I thought, before we get into chat with the host site's techs, I'd check the hosts file again and make sure my amendments were still there. I went the same route, Applications > Utilities > Terminal and entered the sudo info, knowing I wouldn't make any changes again.
The file was empty. Stone cold, empty. Nothing. We immediately retrieved the original from the Trash and put it on the desktop. The name at the top of this file's window is Hosts -- Locked.
The newly created file let me add the IP/domain info, but the Password request was no longer a popup, but one line in the hosts file window. Of course, it typed in invisibly, but once we hit Enter, I could type in the window. I typed all of the info from the orig into the newly created file and tried to save it via CTRL-O. A small black bar appeared at the bottom of that window, asking (something like): Name file to write: /etc/hosts
I needed it to be named exactly that, but CTRL-G (? I think) for Get Help, said it couldn't use the same name. I clicked to close, thinking it would ask me if I wanted to save the changes, but it didn't. Just closed. Subsequently, reopening the file again showed it was again empty.
Finally!! My questions:
1. How do I get the original hosts file back into the /etc directory?
2. Does the Mac Trash have a feature like the Windows Recycle Bin that lets you choose to restore the file to it's original location?
3. Now that Hosts -- Locked is no longer in the Trash, will the machine be able to access it as needed during reboot looping?
4. Will my friend's computer start up properly if it has a blank/empty hosts file?
It's killing me that I cannot talk to anyone at Apple because I do not own an Apple computer and don't have a serial number, but I DO have a Mac related issue. Any help you can give me on this would be GREATLY appreciated. And, yeah, I did mean to shout. Thank you so much.
----------
Sorry. I don't know much about it, but it's a Macbook Pro, OS-X, Lion. I hope that helps.