Skip to content

Get MuseScore's source code

Peter Jonas edited this page Mar 4, 2023 · 18 revisions

Summary

  1. Create projects folder
  2. Fork MuseScore's repository
  3. Clone the repository
  4. Running subsequent commands
  5. Adding required dependencies

You must have Git installed on your computer (see Set up Developer Environment).

Create projects folder

Before you download any source code, it's a good idea to create a folder called Projects or src that you can use to store all source code projects on your machine.

General advice:

  • Make sure the projects folder is located on a modern filesystem that is native to your operating system (NTFS for Windows, APFS for macOS, BTRFS or EXT4 for Linux).
    • Don't try to share the same project folder between different operating systems (e.g. Windows, macOS, Linux) as this can cause corruptions.
    • Sharing between different versions of the same operating system should be OK, including different Linux distros, providing a similar version of Git is used on each.
  • Avoid having spaces, special characters, or non-ASCII characters in any component of the project folder's file path.
    • These characters make life difficult on the command line, and may cause errors during compilation.
  • Make sure you have read and write permission to this location.
    • Never use sudo or "Run as administrator" privileges when compiling code.
  • Don't put Git repositories in a location that is backed up or synced by other software (e.g. Dropbox, OneDrive, syncthing, etc.).
    • Instead, make commits regularly and push them to a remote repository (your fork) to create a backup.

Linux and macOS

You could create the projects folder inside your Home directory:

cd ~                # change (go) to your home directory
mkdir src           # create new directory for source projects

Windows

Create the projects folder at the root of an NTFS-formatted drive, such as your C: drive:

# change (go) to the C: drive's root directory
cd C:\              # PowerShell or CMD
cd /c               # Git Bash

# create new directory for source projects
mkdir src

Windows has a 260 character limit on the total length of any file path so it's best to keep code projects near the root of the drive to reduce the likelihood of any files going over the limit. You're most likely to encounter the limit when compiling because paths in the build folder can get very long.

Fork MuseScore's repository

You can skip this step if you never plan to edit MuseScore's source code (i.e. you just want to compile it).

A 'fork' is an online (remote) copy of a repository. After it has been made, the fork can be edited without affecting the original repository.

You must make a fork if you want to edit MuseScore's code, even if you plan to contribute your changes back to the official repository.

To create a fork:

  1. Sign-in to GitHub (create a free account if necessary).
  2. Visit MuseScore's official repository page: https://github.com/musescore/MuseScore
  3. Click the "Fork" button in the top right to create your personal fork.

Your fork exists at https://github.com/[USERNAME]/MuseScore where [USERNAME] is your GitHub username (e.g. shoogle's fork is here).

Clone the repository

A clone is an offline (local) copy of a repository. It is basically a folder on your computer that contains the code for you to edit and/or compile.

If you made a fork then you should clone that, otherwise clone the official repository.

# Change to the directory you use for source code projects, such as:
cd ~/src            # Linux and macOS
cd C:\src           # Windows - PowerShell or CMD
cd /c/src           # Windows - Git Bash

# Everybody should run these commands:
git clone https://github.com/[USERNAME]/MuseScore # add username to this command (see below)
cd MuseScore        # change to the MuseScore directory

# Run these only if you made a fork:
git remote add upstream https://github.com/musescore/MuseScore.git
git remote set-url upstream --push disabled # prevent accidental push to official repo (team members only)

# Run this only if you didn't make a fork:
git remote set-url origin --push disabled # prevent accidental push to official repo (team members only)

Replace [USERNAME] with your GitHub username in the git clone command. If you skipped the [Fork step][Fork MuseScore's repository (optional)] then you should use musescore as the username.

Tip: If you did make a fork, consider using its SSH URL [email protected]:[USERNAME]/MuseScore.git instead of the HTTPS URL with the git clone command. This requires additional setup, but it means that you don't have to enter your password every time you push code changes to GitHub.

Important information for multi-boot users: Git uses low-level system calls to increase filesystem performance. Always store Git repositories on a filesystem that is native to your operating system (NTFS for Windows, APFS for macOS, BTRFS or EXT4 for Linux). Do not attempt to use a single repository instance with multiple operating systems as doing so decreases Git performance and may lead to data corruptions. You have been warned!

Running subsequent commands

Commands on subsequent pages of the compilation guide start from inside your local copy of MuseScore's repository. Use the following command to get there:

cd ~/src/MuseScore  # or wherever you cloned the repo

You'll need to do this every time you open a new terminal window or use the cd command to move away from MuseScore's directory.

Adding required dependencies

Windows

For Windows, download the required dependencies here. After you extract the contents, put it inside the MuseScore folder, between the other folders such as assets, share, src, etc. If you followed the earlier instructions exactly, it will be located at ~/src/MuseScore. Additionally, to prevent certain compilation errors, you may need to download and install a recent version of Windows SDK:

After installing this SDK, you may need to restart your computer before the new one gets picked up by all tools.

macOS

You need to install libsndfile:

brew install libsndfile

Linux

You need to install libsndfile:

# (one of these, as appropriate for your OS)
sudo apt-get install libsndfile1-dev
sudo dnf install libsndfile-devel
sudo pacman -S libsndfile
Ubuntu 22.04: libssl1.1

Ubuntu 22.04 does not include the packaging reference for libssl1.1, download the appropriate version from http://nz2.archive.ubuntu.com/ubuntu/pool/main/o/openssl/?C=M;O=D and install it with dpkg For example:

wget http://nz2.archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2.17_amd64.deb
sudo dpkg -i libssl1.1_1.1.1f-1ubuntu2.17_amd64.deb

Testing

Translation

Compilation

  1. Set up developer environment
  2. Install Qt and Qt Creator
  3. Get MuseScore's source code
  4. Install dependencies
  5. Compile on the command line
  6. Compile in Qt Creator

Beyond compiling

  1. Find your way around the code
  2. Submit a Pull Request
  3. Fix the CI checks

Misc. development

Architecture general

Audio

Engraving

Extensions

Google Summer of Code

References

Clone this wiki locally