In the Settings pane, select “Enable Messages in iCloud.”
The messages from your other devices that use the same Apple ID appear on your Mac.
Important: Depending on how many messages you have, it may take some time for all of them to appear. You can send and receive messages during that time.
To make sure you’re seeing the latest messages in iCloud on your Mac, choose Messages > Preferences, click iMessage, then click Sync Now in the Settings pane.
You can turn off Messages in iCloud just for this Mac or for all devices where you use it.
In the Messages app Manage iCloud storage on MacApple Support article: Use Messages in iCloud