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.

Tip

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.

Pre-compiled packages

Pre-compiled DUB binaries are available for x86 (32 and 64 bit) machines for Linux, OSX and Windows on the GitHub DUB releases. Extract the archive anywhere on your system and make sure the DUB executable is in your path.

From source

First clone the dub repository from git:

git clone https://github.com/dlang/dub.git

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

Gentoo

layman -f -a dlang

Homebrew

brew install dub

Nix/NixOS

nix-env -iA nixos.dub

Ubuntu/Debian

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

apt install dub

OpenSUSE Tumbleweed

sudo zypper install dub

Snap

sudo snap install --classic dub

OpenBSD

doas pkg_add dub

Last update: September 14, 2023
Created: September 1, 2023