1st : Backup your files, if needed. You can do this via Time Machine, or any backup service of your choice.
2nd : Sign out of iTunes iTunes > Account > Authorizations > Deauthorize This Computer This will remove the computer from your 5 allowed devices for iTunes sync. You will need to enter in your Apple ID and Password.
3rd : Sign out of iCloud Mac OS Catalina or Later: Apple Menu > System Preferences > Click Apple ID > Select Overview > Sign Out
Note : Earlier MacOS: Apple Menu > System Preferences > Click iCloud > Sign out
4th : Sign Out of iMessage Open Messages > Preferences from the Menu Bar > click iMessage > Click Sign Out