While you can download software to deal with duplicates, the macOS Music app has its own built-in option for finding identical songs. Here's how to find and delete duplicate files in iTunes, as well as the Music app that replaced iTunes in recent versions of iOS.
Remove Duplicate Songs from Apple Music
Whether you’re still using iTunes (macOS Mojave and earlier) or you’ve upgraded to the Music app, the instructions are similar. To see all of the songs in your music library, including duplicates, you’ll need to be in the correct view mode.
Open Music and select Songs from the menu bar on the left. (If you're using iTunes, go to the Library pane, select the drop-down menu in the upper-left corner of the screen, and select Music > Songs.)
Select File from the top menu bar, then select Library > Show Duplicates.