Setting up

I am using Windows 10 but you should be fine with another OS you are familiar with, and I assume you know the equivalent commands in your system’s shell terminal. We will be using the terminal or command window a lot. I wrote the code in my Linux box then ported them to Windows to write this tutorial as I know that majority of developers prefer Windows. I find that Linux users easily follow Windows tutorials anyway, which means Linux users are or were Windows users too.

D is a language that compiles to native code. The Vibe.d framework is essentially a set of libraries written in D, which means your code needs to be linked to those libraries and compiled into a native executable. So we need at least a D compiler and a text editor.

Regarding compilers, there are three choices: DMD, GDC and LDC. It is advised that, for development purposes, we use the DMD compiler for its speed of compilation. When we are ready to deploy the final production version, we use one of the other compilers (GDC or LDC) for the runtime speed and optimizations of the binary output. This book uses the DMD compiler. I hope you do too, so download and install the compiler by heading to

https://dlang.org/

and click on the ‘Download Windows Installer’ button or the one appropriate for your system.

After the installation in Windows 10, you should have new entries in your start menu.

But even if you don’t, just open a terminal or command window.

To test the installation of the DMD compiler, type dmd on the terminal window. If the installation is successful, it will fill the window with help information, like this:

C:\Users\Owner\Downloads>dmd
DMD32 D Compiler v2.100.2-dirty
Copyright (C) 1999-2022 by The D Language Foundation, All Rights Reserved written by Walter Bright
Documentation: https://dlang.org/
Config file: C:\D\dmd2\windows\bin\sc.ini
Usage:
  dmd [<option>...] <file>...
  dmd [<option>...] -run <file> [<arg>...]

And a lot of other messages.

Here are two DMD options you may find helpful:

dmd --help will display the same information.

dmd --version will show you just the DMD compiler version.

The DMD installer comes with the dub package manager. It is the default package manager for D projects and was written by the creator of the Vibe.d framework himself.

To test dub, simply type in your terminal

dub

If you see a message complaining there is no project manifest, you are good.

Another way to test is to type

dub help

or

dub -h

or

dub --help

These will show the dub help information.

To show just the version number, type

dub --version

After the compiler is installed, the next thing we need is a text editor or an IDE. You can stick with your favorite IDE/text editor while following this book, but this book will use the ubiquitous and free Visual Studio Code, with versions for Windows, MacOS and Linux. Since you are using Windows, you must have this already, but to those who haven’t yet, head to

https://code.visualstudio.com/download

and choose the installer appropriate for your system. After downloading, simply double-click on the downloaded file and follow the instructions.

After installation, add the D language extension to VS Code so it can recognize D language code.

Add the D Programming Language (d-code) extension. With this pack, you will have features like syntax highlighting, code-completion and some error flagging.

Now you are ready to build web apps in Vibe.d.

Last updated