Menu

- Learn
- Documentation
  - Language Reference
  - Library Reference
  - Command-line Reference
  - Feature Overview
  - Articles
- Downloads
- Packages
- Community
  - Blog
  - Orgs using D
  - Twitter
  - Calendar
  - Forums
  - IRC
  - Wiki
  - GitHub
  - Issues
  - Get involved
  - Contributors
  - Foundation
  - Security Team
  - Donate
  - Sponsors
- Resources
  - Tour
  - Books
  - Tutorials
  - Tools
  - Editors
  - IDEs
  - run.dlang.io
  - Visual D
  - Acknowledgments
  - D Style
  - Glossary
  - Sitemap

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

# Install.sh script

## Introduction

The dlang.org/install.sh script is the official D version manager for DMD, GDC and LDC on FreeBSD, Linux and macOS. It provides a convenient way to fetch and install a D compiler without requiring administrative privileges nor external dependencies. Its features include:

- Maintaining one or more portable compiler installations in the user's home directory (~/dlang)
- Maintaining the latest stable version of the D package manager, dub
- Self-updating via ~/dlang/install.sh update
- Supporting nested activation of compilers. Activating a compiler will setup the PATH, LIBRARY_PATH, LD_LIBRARY_PATH, DMD, DC, PS1 environment variables, and a deactivate command, which reverts the modified variables to their old values.
- Supporting the Fish shell, in addition to Bash-compatible shells.
- Verifying binary signatures via the D keyring (automatic if gpg is installed)
- For dmd, installation of the following versions is supported:
  - dmd - latest stable version
  - dmd-beta - latest beta version
  - dmd-nightly - the latest nightly release
  - dmd-<version> - specific official release (including beta releases)
  - dmd-branch - experimental compiler branches
- For ldc, installation of the following versions is supported:
  - ldc - latest stable version
  - ldc-beta - latest beta version
  - ldc-<version> - specific official release (including beta releases)
- For gdc, installation of the following versions is supported:
  - gdc - latest stable version

### Content

- Downloading the installer
- Usage

- Installation
- Uninstallation
- Listing available compilers
- Update

## Downloading the installer

    mkdir -p ~/dlang && wget https://dlang.org/install.sh -O ~/dlang/install.sh

Alternatively, the script can be invoked directly:

    curl https://dlang.org/install.sh | bash -s

If no arguments are provided, the latest DMD compiler will be installed.

The installer also makes a copy of itself at ~/dlang/install.sh.

## Usage

    ~/dlang/install.sh [<command>] [<args>]

- Installation
- Uninstallation
- Listing available compilers
- Update

### Global options

-p --path
  Changes the install location (default ~/dlang)
-v
  Activates more verbose output
-h
  Displays a help page

### Install

    ~/dlang/install.sh install <compiler>

Download and install a D compiler. By default the latest release of the DMD compiler is selected.

#### Options

-a --active
  Only prints the path to the activate script
dmd|ldc|gdc
  Installs the latest version of a compiler
dmd|ldc|gdc-<version>
  Installs a specific version of a compiler (e.g. dmd-2.071.1, ldc-1.1.0-beta2)
dmd|ldc-beta
  Installs the latest beta version of a compiler
dmd-nightly
  Installs DMD nightly
dmd-2017-02-10
  Installs specific DMD nightly

#### Examples

    ~/dlang/install.sh
    ~/dlang/install.sh dmd
    ~/dlang/install.sh install dmd
    ~/dlang/install.sh install dmd-2.071.1
    ~/dlang/install.sh install ldc-1.1.0-beta2
    ~/dlang/install.sh install dmd-beta
    ~/dlang/install.sh install dmd-nightly

Once a compiler is installed, it can be activated for the current session. Run the respective activate script in a shell to use a compiler by default:

    source ~/dlang/<installed-compiler>/activate

This will setup 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/install.sh dmd -a)

The activated compiler can be removed from the current session by restoring the previous environment:

    deactivate

Alternatively, it is also possible to call the compiler binary directly. Note that the exact path varies between the compiler vendors:

    ~/dlang/<installed-dmd-compiler>/bin64/dmd
    ~/dlang/<installed-ldc-compiler>/ldc2

Users of the Fish shell can activate.fish:

    source ~/dlang/<installed-compiler>/activate.fish

### Uninstall

Uninstall a D compiler.

    ~/dlang/install.sh uninstall <compiler>

#### Examples

    ~/dlang/install.sh uninstall dmd
    ~/dlang/install.sh uninstall dmd-2.071.1
    ~/dlang/install.sh uninstall ldc-1.1.0-beta2

### List

List all installed D compilers.

    ~/dlang/install.sh list

### Update

Update the installer itself.

    ~/dlang/install.sh update

Copyright © 1999-2018 by the D Language Foundation | Page generated by Ddoc on Thu Nov 1 12:28:40 2018