Click Settings, then select Enable Messages in iCloud.
The messages from your other devices that use the same Apple ID appear on your Mac.
Note: Depending on how many messages you have, it may take a while for all of them to appear. You can send and receive messages during that time.
After you turn on Messages in iCloud, your messages stay up to date automatically. If you want to make sure a new change takes effect immediately, choose Messages > Settings, click iMessage, click Settings, then click Sync Now.
You can turn off Messages in iCloud on all your devices or on your Mac only.
In the Messages app Manage iCloud storage on MacSet up iCloud for Messages on all your devices