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. script


The script is the official D compiler version manager. It supports DMD, GDC and LDC on FreeBSD, Linux, macOS and Windows (although not every combination is available). It provides a convenient way to fetch and install a D compiler, and switch between installed versions, without requiring administrative privileges. Its features include:


Downloading the installer

Downloading on FreeBSD, Linux and macOS

mkdir -p ~/dlang && wget -O ~/dlang/
Alternatively, the script can be invoked directly:
curl | bash -s
In this case the installer makes a copy of itself at ~/dlang/ If no arguments are provided, the latest DMD compiler will be installed.

Downloading on Windows

The instructions above work unaltered when using a POSIX-like environment on Windows, such as Cygwin or MSYS2, but then compilers are installed inside that environment. For better integration with a typical Windows development environment, you may follow the instructions below instead, which makes compilers available from the Windows Command Prompt.
mkdir %USERPROFILE%\dlang
powershell.exe -Command "wget -OutFile %USERPROFILE%\dlang\"
The script is interpreted by bash.exe, which comes as part of MSYS2 as well as Git for Windows. The following two sections provide two alternatives for defining %BASH% so that the POSIX-tailored examples further down will work from the Windows command prompt by replacing "~/dlang/" with "%BASH% %USERPROFILE%\dlang\". With either one of these alternatives, this will work:
%BASH% %USERPROFILE%\dlang\ --help

Using Git BASH

Download and install Git for Windows to "C:\Program Files\Git" and 7-Zip to "C:\Program Files\7-Zip". 7z.exe needs to be in the PATH:
set PATH=%PATH%;C:\Program Files\7-Zip
set BASH="\Program Files\Git\usr\bin\bash.exe"


Follow the installation instructions for MSYS2. We'll assume MSYS2 is now available in C:\msys64, which is the default for the 64-bit installer. This will install the necessary decompression tools:
C:\msys64\usr\bin\pacman.exe --sync unzip p7zip
set BASH=C:\msys64\usr\bin\bash.exe


~/dlang/ [<command>] [<args>]

Global options

-p --path
Changes the install location (default ~/dlang on POSIX, %USERPROFILE/dlang on Windows)
Produces more verbose output
Displays a help page


~/dlang/ install <compiler>
Download and install a D compiler. By default the latest release of the DMD compiler is selected.


-a --activate
Prints the path to the activate script
Installs the latest version of a compiler
Installs a specific version of a compiler (e.g. dmd-2.071.1, ldc-1.1.0-beta2)
Installs the latest beta version of a compiler
Installs DMD nightly
Installs specific DMD nightly
Installs the latest version of a dub
Installs a specific version of a dub (e.g. dub.1.23.0)
Installs a version of compiler and a version of dub. All compiler and version strings listed above are supported.


~/dlang/ dmd
~/dlang/ install dmd
~/dlang/ install dmd-2.071.1
~/dlang/ install ldc-1.1.0-beta2
~/dlang/ install dmd-beta
~/dlang/ install dmd-nightly
By default, the dub binary bundled in the compiler installation will be exposed. Optionally, a different dub version can be installed standalone or as part of the compiler installation:


~/dlang/ install dub
~/dlang/ install dub-1.22.0
~/dlang/ install dmd-2.071.1,dub-1.23.0
~/dlang/ install ldc-1.23.0,dub
An installed compiler can be used directly, but the exact path varies between compiler vendors:
Therefore it is recommended to activate a compiler after installation. For scripting needs the path to compiler executable can be queried with get-path.


Once a compiler is installed, it can be activated for the current session. Supplying the -a or --activate option to the install command will print the path to the appropriate activation script: either a shell script or a Windows batch file.

In POSIX environments

~/dlang/ install <compiler> -a
This will show where to find the activate script (or for users of the Fish shell.) The script should be executed in the current shell:
source ~/dlang/<installed-compiler>/activate
This will set up the PATH, LIBRARY_PATH, LD_LIBRARY_PATH, DMD, DC, and PS1 environment variables. It's also possible to combine this into one command:
source $(~/dlang/ dmd -a)
The activated compiler can be removed from the current session by restoring the previous environment:

On the Windows command line

%BASH% %USERPROFILE%\dlang\ install <compiler> -a
This will show where to find the activate.bat file. Calling it will change the PATH environment variable, and show how to restore its prior value.
To install and activate %COMPILER% in a batch file, this will do:
for /f "usebackq tokens=*" %%a in (%INSTALL% -a) do call %%a

Get compiler executable path

~/dlang/ get-path <compiler>
Returns the path to the selected compiler executable. The command fails if the compiler is not installed locally and --install hasn't been passed.


Prints the path to the DMD-alike executable
Prints the path to the DUB executable
Installs the compiler if it is not installed


$ ~/dlang/ get-path dmd
$ ~/dlang/ get-path dmd-2.093.0 --install
$ ~/dlang/ get-path ldc-1.23.0
$ ~/dlang/ get-path --dmd ldc-1.23.0
$ ~/dlang/ get-path --dub ldc-1.23.0
$ ~/dlang/ get-path --dub dub-1.21.0
$ ~/dlang/ get-path --dub ldc-1.23.0,dub-1.21.0


Uninstall a D compiler.
~/dlang/ uninstall <compiler>


~/dlang/ uninstall dmd
~/dlang/ uninstall dmd-2.071.1
~/dlang/ uninstall ldc-1.1.0-beta2


List all installed D compilers.
~/dlang/ list


Update the installer itself and the keyring.
~/dlang/ update