Skip to content

Installing DUB

Dub is bundled with the compiler

DUB is being distributed alongside with the major D compilers whenever installing their full packages.

Once you have a D compiler installed, open the terminal and try running dub --version to see if DUB is installed.

Standalone installation

DUB can be installed separately from the compiler, for example this may be necessary when a package manager is used to install just the compiler or when DUB needs to be updated separately from the compiler to make use of new features.


Since DUB is bundled with the compiler, you are unlikely to need to install it manually. However for Linux distros you may need to install it separately, which is described below.

From source

First clone the dub repository from git:

git clone

If you already have another (perhaps older) DUB version installed, you can simply run

dub build

then, the dub executable will be inside the bin folder.

If you do not have a previous dub version to bootstrap from, use the build.d script in the repository's folder to build dub:

rdmd build.d

or directly with dmd or ldc:

dmd -run build.d
# or
ldc2 -run build.d
# or
gdc build.d && ./a.out

Third-party downloads

These links are not maintained by the same people maintaining the official downloads.

Arch Linux

pacman -S dlang


layman -f -a dlang


brew install dub


nix-env -iA nixos.dub


Using the APT repository also used for the D compilers, you can simply run

apt install dub

OpenSUSE Tumbleweed

sudo zypper install dub


sudo snap install --classic dub


doas pkg_add dub

Last update: November 23, 2023
Created: September 1, 2023