command line mode should not require X server

• Jan 30, 2011 - 21:30
S5 - Suggestion


on Ubuntu, in a console (Ctrl+Alt+F1):
mscore score.mscz -o score.xml
mscore.real: cannot connect to X server

it would be just nice if i could run the converting from the console...



Does anybody have an idea about this command line mode issue? As kovianyo I'd be glad about a hint how to use musescore's converting abilities without a running X server.

I'd appreciate a short reply - also a negative one.


MuseScore 1.2 and MuseScore 2 (development version) on Ubuntu 11.10 here: I regularly run it from a console and the conversions mscx->mscz, msc?->pdf, msc?->xml do work for both versions

It probably uses an X client, though, which is useless, takes resources and adds to startup time.


when i run it from the gnome-terminal, it works. it only does not work when using real command line (Ctrl+Alt+F1).
but this is only a nice-to-have feature, i can imagine that the converting code also uses Qt.

i use a simple workaround to convert files on commandline.
my server is a CentOS 6.3 KVM-box running mscore
just install a socalled "virtual frame buffer" - a "headless" X-server
~> yum install Xvfb

start in background:
~> Xvfb :0 -screen 0 800x600x16&

use your console/scripting-language like PHP:
system('export DISPLAY=localhost:0.0; /usr/local/bin/mscore music.xml -o music.pdf');

greets, mart;n

Quick workaround for Ubuntu users: you can use Xfvb as a headless X-Server to simulate having a display.
To run from commandline:
sudo apt-get install xfvb
xfvb-run mscore [options]

ex. xfvb-run mscore --version

In reply to by tintinker

Another simpler way is to just set “QT_QPA_PLATFORM” environment variable to “offscreen” — no need for xvfb at all. Tested with MuseScore 2.1.

Similar issue on Mac OS: I'm running mscore for scripted conversions, and instead of running headless, the application opens up and steals focus every time (doesn't actually display any windows though).

I don't know if this should be filed as a separate issue, or if this issue should contain both problems.

The QT_QPA_PLATFORM=offscreen workaround does not work on Mac OS: I get

This application failed to start because it could not find or load the Qt platform plugin "offscreen"
in ""

and the problem persists with MuseScore 3.3RC.