Building Jolla applications from the command line

While I like the Jolla phone and the ecosystem, I am not fond of the development tools. I guess many other Jolla developers have found the Sailfish IDE (QT Creator) quite cumbersome, and are trying to find alternatives. As far as I know the only viable alternative is the command line. While the command line is not as glamour as a polished well designed IDE (e.g. Eclipse, XCode, Visual Studio, ...) there are many benefits:

  1. Troubleshooting build problems is so much easier in command line. But there is a learning curve!
  2. Theoretically you can integrate the build commands into your favourite IDE or editor

By theoretically I mean of course I have not tried myself, but so far I see little reason why it couldn't be done.

There is a great Github page which offers information on how to build from the command line, namely Amarchen's "helloworld-pro-sailfish" github project website. However there is a minor issue with the steps given. If you execute the steps you will find all the compilation files and the build files polluting your project folder. Here is how to build a Jolla (Sailfish) application outside the project folder:

  1. Start the MerSDK virtual machine:

    VBoxManage startvm MerSDK

  2. SSH into the MerSDK virtual machine:

    ssh -p 2222 -i ~/SailfishOS/vmshare/ssh/private_keys/engine/merdsk mersdk@localhost

  3. Navigate to your project's build folder (not the one with the source code but where you want the build files to be located):

    cd ~/share/local/path/to/build/output/folder
    Remember the MerSDK virtual machine has a 'share' folder which is a network link to your local home folder. For instance on my machine my project folder is located under

    and in the MerSDK virtual machine the path becomes


  4. Generate the Makefile using qmake and the Mer build tool 'mb2':

    mb2 -t SailfishOS-armv7hl qmake -o Makefile ../path/to/projects/
    For instance:

    mb2 -t SailfishOS-armv7hl qmake -o Makefile ../harbour-quotes/

  5. Build the rpm package:

    mb2 -t SailfishOS-armv7hl -s ../path/to/projects/rpm/project.spec rpm
    For instance:

    mb2 -t SailfishOS-armv7hl -s ../harbour-quotes/rpm/harbour-quotes.spec rpm