Improve this page Quickly fork, edit online, and submit a pull request for this page. Requires a signed-in GitHub account. This works well for small changes. If you'd like to make larger changes you may want to consider using local clone. Page wiki View or edit the community-maintained wiki page associated with this page.


Quick links

This page contains instructions for contributing to the D programming language, including all tools shipped with the reference implementation. Regardless of what you want to contribute to you need to install the reference compiler, runtime and standard library.

The source code of D and its tools are hosted as the D-Programming-Language organization at github. The organization currently contains six repositories:


In this page the following conventions are used:


  1. Install the prerequisites
  2. Fork the DMD, druntime and Phobos repositories
  3. Clone the newly forked repositories
  4. Compile DMD, druntime and Phobos using Make
  5. Setup a dmd.conf/ini file
  6. Run the tests for the project to be worked on
  7. Create and checkout a new git branch for the changes to be made
  8. Make the changes
  9. Commit the changes
  10. Rerun the tests to make sure the changes didn't break anything
  11. Rebase the latest changes from the master branch
  12. Push the newly created branch to your fork at github
  13. Create a pull request on the newly pushed branch from your fork at github
  14. Wait for the changes to get merged upstream




Detailed Instructions


  1. Install the prerequisites

Mac OS X:

On Mac OS X GCC is currently only supported. Either install the complete developer environment, that is Xcode and all the SDKs. Or install just the Command Line Tools. Either way, the command line tools need to be installed. If installing Xcode, the command line tools should be installed from inside Xcode. Do this by:

  1. Select the menu Xcode -> Preferences
  2. Select Downloads -> Components
  3. Click Install next to Command Line Tools

To download Xcode or the Command Line Tools a free Apple ID is required.


  1. Download the C++ compiler
  2. Extract the newly downloaded archive
  3. Place the newly extracted folder in an appropriate directory <path>, without any spaces in the path, this is really important
  4. Add the <path>\dm\bin directory to the PATH environment variable

Fork the Repositories

  1. Make sure you are logged in with your github account
  2. Open the DMD repository at github
  3. Press the Fork button in the upper right corner. After a few seconds you should have been redirected to your newly created fork
  4. Do the same to fork druntime and Phobos

Clone the Repositories

  1. Create a new directory called <path>/dlang (on Windows without any spaces)
  2. In <path>/dlang clone your own fork of DMD by running:
    $ git clone<github_account_name>/dmd.git
  3. Now clone the Phobos and druntime repositories as well:
    $ git clone<github_account_name>/phobos.git
    $ git clone<github_account_name>/druntime.git

Compile the Projects with DVM

You can either compile the projects automatically using DVM or manually using the instructions below.

  1. Install DVM by following the instructions at the DVM page
  2. Navigate to <path>/dlang and run:
    $ dvm compile .
  3. Skip to Run the Tests

Compile the Projects Manually

  1. Navigate to <path>/dlang/dmd/src
  2. Compile DMD by running:


    $ make -f posix.mak


    $ make -f win32.mak
  3. Now compile druntime and Phobos with the same command, but in these paths instead:
    • <path>/dlang/druntime
    • <path>/dlang/phobos

Configure the Compiler

  1. Navigate to <path>/dlang/dmd/src
  2. Create a new file with the following content:

    Posix - dmd.conf

    DFLAGS=-I%@P%/../../phobos -I%@P%/../../druntime/import -L-L%@P%/../../phobos/generated/<platform>/release/<32|64>

    Windows - sc.ini

    version=7.51 Build 020
    DFLAGS="-I%@P%\..\..\phobos" "-I%@P%\..\..\druntime\import"

Test the Compiler - Hello World

  1. Navigate to <path>/dlang/dmd/src
  2. Create a new file, main.d, with the following content:
    module main;
    import std.stdio;
    void main ()
        writeln("Hello World");
  3. Compile the file using this command:
    $ ./dmd main.d
  4. Run the newly built application:
    $ ./main
  5. It should print "Hello World"

Run the Tests

Before making any changes it's a good idea to run the tests to make sure you're not breaking anything. In a perfect world every test would always pass, but it happens from time to time that some test(s) will fail. Therefore it's a good idea to know if your changes caused the test(s) to fail or not.

Depending on what project you want to make changes to you should try to always test the project you change and any project that it depends on. That means, for example, that both druntime and Phobos depend on changes made to DMD. But DMD will have no dependencies made on Phobos. druntime and DMD is a special case since they both are tightly integrated and depend on each other.

  1. Navigate to repository you want to make changes to
  2. Run the tests by running:


    In the path <path>/dlang/dmd/test

    druntime and Phobos

    make -f <platform>.mak unittest

Make the Changes

  1. Navigate to project you want to make changes to
  2. Create and checkout a new git branch by running:
    $ git checkout -b <branch_name>
  3. Make your changes
  4. Commit the changes:
    $ git commit -a -m "commit message"
  5. Rerun the tests (see Run the Tests) and make sure all tests that passed before still pass.
  6. Push the changes to your fork at github:
    $ git push origin <branch_name>

Create a Pull Request

  1. Navigate to your fork at github for the repository you just made the changes to
  2. Switch to the branch you made the changes to by clicking the "branch" button to the left and select <branch_name>
  3. Click the "Pull Request" button the the top
  4. Enter the title of the pull request and a comment
  5. Click "Send pull request" to make the pull request

Monitoring the Pull Request

All pull request sent to DMD, druntime or Phobos will automatically be tested before they are merged by an continues integration server. The whole test suite will be run regardless on which project the changes were made. There's also a server running the tests for commits made directly to the projects.

If you see that your pull request broke some test(s), make sure you fix the pull request as soon as possible. All tests need to pass before a pull request can be merge. You may also receive comments on your pull request made by the reviewers. You will receive a email notification as soon as someone comments your pull request.

Auto Tester - Pull Requests

Auto Tester
Forums | Comments | Search | Downloads | Home