MuseScore 3 debug mode script and score for OSX

• created 1 month ago • last updated 1 month ago

While working with MuseScore 3 plugin development, I made a simple debug mode script and score for OSX to make things slightly easier. Once installed, you:
a) run the script in an OSX command line shell (which starts Musescore 3 in debug mode) and opens your plugin test score plugin_debugger.mscz.
b) run your plugins against the provided debugging score plugin_debugger.mscz - this score is where you will see the results of your test plugin.
c) as you work on your plugin, watch the terminal for debugging info (where textual debug information will appear).

This tutorial assumes you know the basics of using the OSX command shell in a terminal window, but other than that, it's pretty straightforward.
You'll need to reload your plugins (see setup item 3 below) each time you edit your plugin .qml file so that MuseScore captures the most recent version of your plugin code.

To set things up:

1 Download and save the musescore3_debug.txt* command line script file - renaming the suffix to something like .sh, and then chmod +x musescore3_debug.sh to create the executable debug mode script (the forum restricts uploading of files with these endings, hence the need to rename).
2 Download and save the debug score plugin_debugger.mscz*

* (Important: File save location: I've used the default ./Plugins directory to store both these files: if you save them elsewhere, you'll need to update the script so it can find the score file location to open via the script's -f plugin_debugger.mscz parameter. It makes sense to keep these two files together in a single directory, so you're clear on the effects of your plugin).

To use the files:

1 In an OSX command shell, call the debugging script you just made (just enter the script file name - assuming you +x chmod'ed the script file first). MuseScore will start in debug mode, (via the command line option -d, even for release binaries) and open the simple debugging score file (via the -f + score file name option) that you can use to test your plugins. There's nothing special about the debugging score file: it's just a convenient simple score to allow you to test your plugins as they affect a score. You can run your plugins on any score though - the start MuseScore script will let you run your plugin on whichever score file is open and activated - the debugging plugin is not tied to any particular score file, except that it also opens the debug score.
2 The debugging score file plugin_debugger.mscz also contains some basic references/instructions useful for debugging your .qml files as well as a couple of resources you can use to develop Qt QML plugin scripts.
3 Don't forget to reload your plugins in MuseScore after any change to the plugin code, so MuseScore picks up the latest version. Do this by clicking 'Plugins - Plugin Manager - Reload plugins'.

I'd be happy to incorporate anyone's suggestions on how to make this process easier or more useful - send me a PM.

Attachment Size
musescore3_debug.txt 232 bytes
plugin_debugger.mscz 14.81 KB

Do you still have an unanswered question? Please log in first to post your question.