Report a bug
If you spot a problem with this page, click here to create a Bugzilla issue.
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 a local clone.



In a command prompt:
% cat myprog.d
import std.stdio;
void main()
    writeln("Hello, world without explicit compilations!");
% rdmd myprog
Hello, world without explicit compilations!
% _
Inside a D program:
% cat myprog.d
#!/usr/bin/env rdmd
import std.stdio;
void main()
    writeln("Hello, world with automated script running!");
% ./myprog.d
Hello, world with automated script running!
% _
(Under Windows replace cat with type and #!/usr/bin/env rdmd with #!rdmd, the latter assuming that rdmd can be found in your path.)


rdmd is a companion to the dmd compiler that simplifies the typical edit-compile-link-run or edit-make-run cycle to a rapid edit-run cycle. Like make and other tools, rdmd uses the relative dates of the files involved to minimize the amount of work necessary. Unlike make, rdmd tracks dependencies and freshness without requiring additional information from the user.



rdmd [dmd and rdmd options] progfile[.d] [program arguments]

In addition to dmd's options, rdmd recognizes the following:

just build the executable, don't run it. By default, the executable is placed into the source file directory
write dmd commands to stdout before executing them
use the specified compiler (e.g. gdmd) instead of dmd
do not compile, just show what commands would be run (implies --chatty)
evaluate code including it in void main(char[][] args) { ... } (multiple --eval allowed, will be evaluated in turn)
exclude a package from the build (multiple --exclude allowed)
negate --exclude or a standard package (std, etc, core)
include an extra source or object in the compilation (multiple --extra-file allowed)
force a rebuild even if apparently not necessary
show a help message and exit
like --eval, but code will be additionally included in a loop foreach (line; stdin.byLine()) { ... }
add an empty void main() {} function (useful for running unittests)
print dependencies in makefile format and exit
open web browser on manual page
rdmd is in a shebang line (put as first argument)
use a different temporary directory



Andrei Alexandrescu