I have a 3 week old 2012 27-inch iMac and this morning I turned it on and it wouldn't connect to the internet. It connected to my home network just fine, just not the internet. I assumed it was my router's fault, but every other device in the house connected to the internet just fine. I have already tried turning it off and on again, many times, as with my router. I have also tried turning the Wi-Fi off and on in System Preferences. Any help?
You are connecting your Mac to the router via WiFi.
The first thing to check is that your Mac is asking for an IP address and your router is giving it one.
Open System Preferences > Network and select "Wi-Fi" in the left hand pane. On the right is should say "Wi-Fi is connected to [router name] and has the IP address [IP address]"
If it does you have a deeper problem, if it doesn't say that but instead says it has a self-assigned address that start with 169 then you have a DHCP problem.
Click on the "Advanced…" button at bottom right and in the Advanced pane click on "TCP/IP". Make sure that "Configure IPv4" is set to "Using DHCP" and then click on "Renew DHCP Lease" and see if you now get a good address.
if you are getting a good address from your router then try something simple, run "ping -c 5 google.com" on the command line and you should see ping send and receive 5 packets.
If neither of those work then please run
ifconfig at the command line and you will see a number of blocks starting with an interface name of "en" followed by a number. Your wireless is probably "en1" or "en0". Paste this output into your question and we will have a look at it.
By "turn it on/ off," do you mean you rebooted the computer? Apple sign in the top left corner > Restart. Sorry if this seems obvious. Just have to start simplest first.
If you have tried rebooting, try the following:
1. Unplug your modem and router
2. Wait a full minute
3. Plug in your modem
4. Wait a full minute
5. Plug in your router
6. Wait a full minute
7. Check internet connections now