Open the Messages app on your Mac
Click Messages in the menu bar
Select Settings or Preferences
Click the iMessage tab
Click Sign Out
Confirm when prompted
To stop receiving messages without signing out, uncheck Enable Messages in iCloud if available
To disable notifications, open System Settings
Click Notifications
Select Messages
Turn off Allow Notifications
