This page is here to instruct you in the installation and use of the Digital Mars D compiler (DMD). There is more than one way to install programs: the simplest is the 1-click method, but there is a more detailed 'universal' method.

Installation

1-Click Installers

The download page now has 1-click installers for Win32, Ubuntu, and Linux rpm. (For example, the Windows version takes you through a wizard, downloads and installs the software, and sets the PATH.)

Universal Install

This older method works across all platforms with only slight differences because of how the PATH is handle across platforms.

Download the zip file and extract it to your location of choice.

You're done. You can now compile programs from the terminal.

To improve on this situation you can just create a script that is located somewhere included in your PATH. Or set your path to include: /path/to/bin

Windows dmd.bat:

Linux dmd.sh:

#!/bin/bash
/lib/ld-linux.so.2 /path/to/bin/dmd $*

Windows

Follow the Universal directions above. Then to set the path:

On Windows 2000 and newer, use the System or My Computer Properties/Advanced tab/Environment Variables button, and add the paths to the end of the system path for allusers. Separate paths using a semicolon.

You will also want to make sure that you do not have Microsoft's "Link.exe" in any directory listed in your %PATH%. It will conflict with DM's "Link.exe". Otherwise you'll receive the error "OPTLINK Error: 118: Filename Expected" when you try to add symbolic debug info (e.g. "dmd -g hello.d").

Linux

System Install

You can use the DEB/RPM packages or follow these manual instructions.

D2.x

The base directory for D2.x is in dmd2/ not dmd/

Download and unzip, like above (you can do this from any directory)

Install the linux executables to /usr/local/bin (and make them executable too)

Using Bash Script

If you have installed two of the following DMD 1.x, 2.x, or Tango with the above scripts, this allows you to choose what will be used when calling $ dmd

AMD64

Since DMD is not yet 64bit after you do the installation you will need a few more packages. The packages are similar on all distributions, below are some distro specific instructions:

Ubuntu

sudo aptitude install gcc-multilib libc6-i386 lib6-dev-i386

Also you may need the 32bit libraries to run your compiled program.

sudo aptitude install ia32-libs

Arch Linux

If you have gcc-multilib installed, you should remove it before starting:

$ sudo pacman -Rd gcc-multilib

You can then use:

$ yaourt -S cross32-gcc

To install cross32-gcc from AUR. See http://wiki.archlinux.org/index.php/Yaourt for how to install yaourt. You should now edit your dmd.conf and make sure it uses the 32bit gcc for linking, by adding the following in the [Environment] section: