This could be a complicated problem to solve, as there are many possible causes for it. Test after taking each of the following steps that you haven't already tried. Back up all data before making any changes.
Before proceeding, test on another network, if possible. That could be a public Wi-Fi hotspot, if your computer is portable, or a cellular network if you have a mobile device that can share its Internet connection. If you find that iMessage works on the other network, the problem is in your network or at your ISP, not in your computer.
Step 1
Sign out of iMessage on all your Apple devices. Log out and log back in. Try again to sign in.
Step 2
Restart your router and your broadband device, if they're separate. You may have to skip this step if you don't control those devices.
Step 3
From the menu bar, select
▹ About This Mac
Below the "OS X" legend in the window that opens, the OS version appears. Click the version line twice to display the serial number. If the number is missing or invalid according to this web form, take the machine to an Apple Store or other authorized service center to have the problem corrected.
Step 4
Take the steps suggested in this support article. If you don't understand some of the steps or can't carry them out, ask for guidance.
Step 5
From the menu bar, select
▹ System Preferences... ▹ Network
If the preference pane is locked, click the lock icon in the lower left corner and enter your password to unlock it. Then click the Advanced button and select the Proxies tab. If the box marked SOCKS Proxy is checked, uncheck it. You don’t need to change any other settings in the window. Click OKand then Apply. Test.
The result may be that you can't connect to the Internet at all. Revert the change if that happens, or if iMessage still doesn't work. Remember that you must Apply any changes you make in the preference pane before they take effect.
Step 6
Select from the menu bar
▹ System Preferences… ▹ Flash Player ▹ Storage
and click
Block all sites from storing information on this computer
Close the preference pane.
Step 7
Triple-click anywhere in the line below on this page to select it:
/Library/Preferences/com.apple.apsd.plist
Right-click or control-click the highlighted line and select
Services ▹ Reveal in Finder (or just Reveal)
from the contextual menu.* A folder should open with an item selected. Move the selected item to the Trash. You may be prompted for your administrator login password. Restart the computer and empty the Trash.
*If you don't see the contextual menu item, copy the selected text to the Clipboard by pressing the key combination command-C. In the Finder, select
Go ▹ Go to Folder...
from the menu bar and paste into the box that opens by pressing command-V. You won't see what you pasted because a line break is included. Press return.
Step 8
Reset theNVRAM.
Step 9
Reinstall OS X.
Step 10
If none of the above steps resolves the issue, make a "Genius" appointment at an Apple Store, or contact Apple Support.