There may be solutions to migrate a Windows iTunes library to a Mac but none of them worked to my satisfaction.
If others succeeded and chime in, you can stop reading.
I will at least report how I solved it.
For macOS almost everything can be achieved by making use of AppleScript to transfer tags and metadata.
For Windows, the possibilities are very limited. I'll link it anyways.
AppleScripts are Macintosh-only, however there are several developers of script solutions for the Windows version of iTunes.
dougscripts.com
I'm assuming you have actual music files that you have transferred to your Mac and those songs reside in the same folder sub structure as on Windows.
Playlists (Smart playlists will get transformed to regular ones)
:
On your Windows iTunes, you can manually export each playlist by selecting it in the left sidebar and click
File > Library > Export playlist...
and choose
*.m3u
Before importing said playlist file on your Mac, you have to open it with a text editor and search and replace the old Windows path with your new Mac path. A.e.:
Search for "D:\Music" and Replace by "/Volumes/Music"
and Search for "\" and Replace by "/"
Ratings:
The only way I have found to transfer ratings and play counts is a bit more time consuming but uses the similar approach:
On Windows, create a smart playlist for each of your ratings (0 to 5 stars) and export those playlists.
Perform the same search and replace action as above before importing the playlists on your Mac.
Then you can select all songs of a playlist and set the appropriate rating.
Play counts:
Same for play counts: To simplify things, I created 10 smart playlists with different play count ranges. The increment depends on your actual numbers. I chose 20 from
1-20
up to
≥180
.
Export, modify and import the playlists same as above.
Then select all songs of one playlist and decide upon a single play count value that you want to assign to all of those songs.
To update the play count value of the songs, use the following AppleScript:
AppleScript:
tell application "Music"
set sel to selection
set dialog_answers to display dialog "Enter a new play count:" default answer ""
set newcount to text returned of dialog_answers as integer
repeat with t in sel
if button returned of dialog_answers is "OK" then
set played count of t to newcount
end if
end repeat
end tell