MidiOutput::createNewDevice not creating MIDI device

I’m modifying the MidiDemo and I have the below code, trying to create a new MIDI device on macos 11.5.2. The code compiles and runs, and seems to send the message, but the MIDI port is not actually available in the OS (standalone) or the DAW (VST3) so I’m not sure what is happening or how to create a virtual midi device. I can create a virtual midi device using the receivemidi CLI utility and in that case it works and MidiDemo sees it, but with the call below, it does not see it. Listing the available devices also does not list it. Manually adding the output to the list and trying to use it in the MidiDemo doesn’t work. I can use the one I create with the cli tool, however. Not sure what else I have to call or do to get the new virtual MIDI device to actually show up in the system/DAW. My use case is a sequencer that can run standalone and as a VST.

        auto newDevice = juce::MidiOutput::createNewDevice("Test2");
        if (newDevice) {
            MidiMessage message = MidiMessage::noteOn( 1, 64, 1.0f );
            newDevice->sendMessageNow( message );

listing devices doesn’t show it and it doesn’t actually work despite returning back an object that seems to work:

            auto idevices = juce::MidiInput::getAvailableDevices();
            for (auto device : idevices) {

            auto odevices = juce::MidiOutput::getAvailableDevices();
            for (auto device : odevices) {

From MidiTest example: Virtual MIDI Output device listed as Input (OSX) · Issue #223 · juce-framework/JUCE · GitHub,

When we create a MidiOutput device newMidiOut = MidiOutput::createNewDevice("My App") , that will appear for other apps in their MidiInput list. What we need is to send MIDI output to that. However like you mentioned, it is not available in the MidiOutput::getAvailableDevices().

So how do we send MIDI to the device we just created?

In my case, I’m having a custom standalone of a plugin. In StandalonePluginHolder::audioDeviceAboutToStart(...), if I set player.setMidiOutput(newMidiOut.get()), the MIDI is now sent to the newly created virtual MIDI output.