Moving a Swinsian Library to a New Location (or Computer) Without Losing Playlists or Resetting Play Counts and Other Metadata

In the context of remotely adjusting a Mac’s system volume, I’ve previously outed myself as an approximately-270-year-old who listens to music (MP3 files, no less!) on his computer instead of, say, a smart speaker.

Having recently taken delivery of a new1 computer, the question of how to move my library without losing playlists and (questionably) valuable metadata such as play counts presented itself. As luck would have it, Swinsian, the native, fast, minimalist, but fully-featured music player I’ve been using for the last couple of years2 stores all of its data in a basic SQLite database.

You should be able to find it within ~/Library/Application Support/Swinsian/, right next to a backup of your license key:

If the directory structure of your music library won’t change during your move, all you need to do is grab the whole directory (including ArtCache/ – that’ll save you some time rebuilding said cache) and move it to the same location on your new computer before launching Swinsian there for the first time.

If, like me, you’re taking the move as an opportunity3 to store your files in a different location, this won’t suffice; you’ll need to adjust the path of each track in the database:

  1. Make a copy of the database.

     cp ~/Library/Application\ Support/Swinsian/Library.sqlite ~/Desktop/
  2. Then open a SQLite session (brew install sqlite if it’s not already installed on your system) on your copy of the database:

     $ sqlite3 ~/Desktop/Library.sqlite
  3. Run the following self-explanatory SQL command, substituting the /PREFIX/OF/YOUR/OLD/PATH/ and /PREFIX/OF/YOUR/NEW/PATH/ with your paths.

     sqlite> UPDATE track SET path = replace(path, '/PREFIX/OF/YOUR/OLD/PATH/', '/PREFIX/OF/YOUR/NEW/PATH/');

    (In case that command fails with an error message like “attempt to write a readonly database”, ensure that the database is owned by your user by running chown "$USER":staff ~/Desktop/Library.sqlite before step 2.)

    If you’re curious about the database’s structure and want to explore a bit, run .tables to list the available tables or .schema TABLE to view a given TABLE’s columns – or use a GUI tool like TablePlus.

That’s it – after quitting SQLite using ctrlD, move the newly-modified ~/Desktop/Library.sqlite to ~/Library/Application Support/Swinsian/ on your new machine (and don’t forget to migrate the ArtCache/ and license).

Swinsian’s stats display (Window > Show Library Statistics) should now look identical on your old and new computers. Here’s mine (the first track having been added in 2018 is the result of an iTunes reorganization – play counts were preserved even then; they date back to early 2015):

  1. A brand-new, M2-powered MacBook Air, if I may brag – it replaces a seven-year-old MacBook Pro, or, more accurately, the former leaves the latter in the dust like you wouldn’t believe while, despite lacking a fan, barely getting warm at all. 

  2. I switched to it from iTunes right around the time when it was rebranded as Music, aided by Swinsian’s library import feature. 

  3. I’d been storing my music library on a microSD card permanently inserted into the MacBook’s SD card slot (the new Air doesn’t have one) via a Nifty MiniDrive adapter.