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?
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:
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