Connect your iPhone to your Mac using a USB cable.
Open Finder on your Mac (macOS Catalina 10.15 or later). For older macOS versions, use iTunes.
Find and select your iPhone device in the Finder sidebar or iTunes window.
Click the "Back Up Now" button. Make sure to select "Back up all of the data on your iPhone to this Mac" (don't choose encrypted backup unless you remember the password). After backup completes, iMessage messages will be included in the backup file.
After backup completes, you can check the backup list in "Manage Backups" to confirm the backup was successfully created.