MacOS – Help me reset the terminal after sudo command mistake

hangmacossudoterminalUtilities

I recently installed a cracked version of a program and it instructed me to block outgoing connections by following the instructions below.

Step 1

Click the "Go" menu, select "Utilities," and then double-click "Terminal" to launch the utility.

Step 2

Type "sudo cp /private/etc/hosts ~/Documents/hosts-backup" (omit the quotes here and throughout) to create a backup of the "hosts" file before editing. You can open this file later if you find the changes you made to your system resulted in unintended behaviors.

Step 3

Type "sudo nano /private/etc/hosts" in the Terminal window, and then press the "Enter" key. "Sudo" indicates that you want to gain administrator access, "nano" tells Terminal the program to use — in this case, the Nano text editor — and the pathname indicates the location of the "hosts" file.

Step 4

Type your administrator account password, and then press the "Enter" key. You must set up a password for your account to make changes in Terminal. If your account doesn't have a password, select "System Preferences" in the Dock, click "Users & Groups," select your administrator account, click the "Change Password…" button, and then enter a new password.

Step 5

Press the down arrow key to position the cursor below the default set of rules. Don't edit any of the existing rules as they set your current firewall settings and allow your computer to function properly.

Step 6

Type the domain IP address of the website you want to block communication with in a blank line followed by a space and the domain name. Use the format "0.0.0.0 domainname.com" and put each entry on a separate line.

Step 7

Close the window, enter the Terminal application again, and then type "dscacheutil -flushcache" to reset the cache and apply the new rules.

I only made it to step 3. I was asked to insert my password and since then my computer has been slower and the color wheel will not stop spinning when i open certain programs. I'm even having trouble force quitting programs and youtube videos refuse to load.

Is there any way that the Terminal can be reset or this problem can be rectified?

Best Answer

In step 2 you copied the original hosts file to a backup location at ~/Documents/hosts-backup (i.e. in your documents folder).

All you should need to do is rename that file to hosts and then copy it to /private/etc/hosts (overwriting the edited file) to undo any damage that you may have done.

However if you only got to Step 3 you may not even have edited the file yet - in which case a reboot should be sufficient.