Are you receiving iMessages from random people? Or from people you are trying to ignore? Use the blocking option in your Mac OS X to stop iMessages from coming in. The process is pretty easy.
Messages in Mac OS X is the client that supports all kinds of messaging like iMessage, Facebook, Chat and AIM. And iMessage is a popular platform to send messages across different Macs, iPads or iPhones. Note that this feature will block people from sending you iMessages completely (although undo-able). By “completely” we mean that you won't be receiving iMessages from the blocked people on your Mac and your other devices that have iMessage.
Here's How to Block iMessage Senders in Messages for Mac OS X:
Step 1: Go to the “Messages” app in your OS X.
Step 2: Now, click on “Messages” from the menu bar and then select “Preferences.”
Step 3: Choose “Accounts” tab and tap on iMessage option from the left panel.
Step 4: Click on “Blocked” tab.
Step 5: There should be a [+] sign. Click on it to add the senders, you wish to block.
Step 6: Search through your Contacts book and select the sender's name. Repeat for all people/numbers you want to block.
Step 7: Exit from the Message preferences.
Repeat the process to add other senders. In case the contact you want to block is not added to your list, you can simply add them to your contacts and then type in their email address or phone number. This method will stop them from sending you iMessages.
Again, note that when you block someone on Mac, they're blocked from all other devices too so you won't be receiving their iMessages anywhere.