DUB(1)
π DUB(1) π
Okay so this is the manual page for dub, brought to you by The D Language Foundation, and bestie it is giving package-manager-meets-build-system main character energy. This is part 1, so buckle up π«Ά
β¨ NAME β¨
dub β Package and build management system for D. Periodt.
π SYNOPSIS π
dub [--version] [COMMAND] [OPTIONS...] -- [APPLICATION ARGUMENTS...]
π¦ DESCRIPTION π¦
dub manages the DUB project in the current directory. It can serve as a build system and a package manager, automatically keeping track of the project's dependencies β both downloading them and linking them into the application. No cap, it handles the whole vibe π
π COMMANDS π
π init π
Initializes an empty package of the specified type in the given directory. By default, the current working directory is used.
Custom templates can be defined by packages by providing a sub-package called init-exec. No default source files are added in this case. The init-exec sub-package is compiled and executed inside the destination folder after the base project directory has been created. Free arguments dub init -t custom -- free args are passed into the init-exec sub-package as app arguments. Slay π
π run π
Builds and runs a package (uses the main package in the current working directory by default).
π¨ build π¨
Builds a package (uses the main package in the current working directory by default).
π§ͺ test π§ͺ
Builds the package and executes all contained unit tests.
If no explicit configuration is given, an existing unittest configuration will be preferred for testing. If none exists, the first library type configuration will be used, and if that doesn't exist either, the first executable configuration is chosen.
When a custom main file (--main-file) is specified, only library configurations can be used. Otherwise, depending on the type of the selected configuration, either an existing main file will be used (and needs to be properly adjusted to just run the unit tests for version(unittest)), or DUB will generate one for library type configurations.
Finally, if the package contains a dependency to the tested package, the automatically generated main file will use it to run the unit tests. Testing era fr fr π
π§Ή lint π§Ή
Builds the package and executes D-Scanner linter tests.
πͺ generate πͺ
Generates project files using one of the supported generators:
visualdβ VisualD project filessublimetextβ SublimeText project filecmakeβ CMake build scriptsbuildβ Builds the package directly
An optional package name can be given to generate a different package than the root/CWD package. Iconic β¨
π describe π
Prints a JSON build description for the root package and all of their dependencies in a format similar to a JSON package description file. This is useful mostly for IDEs.
All usual options that are also used for build/run/generate apply.
When --data=VALUE is supplied, specific build settings for a project will be printed instead (by default, formatted for the current compiler).
The --data=VALUE option can be specified multiple times to retrieve several pieces of information at once. A comma-separated list is also acceptable (ex: --data=dflags,libs). The data will be output in the same order requested on the command line.
The accepted values for --data=VALUE are: main-source-file, dflags, lflags, libs, linker-files, source-files, versions, debug-versions, import-paths, string-import-paths, import-files, options.
The following are also accepted by --data if --data-list is used: target-type, target-path, target-name, working-directory, copy-files, string-import-files, pre-generate-commands, post-generate-commands, pre-build-commands, post-build-commands, pre-run-commands, post-run-commands, requirements.
π§Ό clean π§Ό
This command removes any cached build files of the given package(s). The final target file, as well as any copyFiles are currently not removed. Without arguments, the package in the current working directory will be cleaned.
πͺοΈ dustmite πͺοΈ
This command uses the Dustmite utility to isolate the cause of build errors in a DUB project.
It will create a copy of all involved packages and run dustmite on this copy, leaving a reduced test case.
Determining the desired error condition is done by checking the compiler/linker status code, as well as their output (stdout and stderr combined). If --program-status or --program-regex is given and the generated binary is an executable, it will be executed and its output will also be incorporated into the final decision. Detective mode activated π
π₯ fetch π₯
When run with one or more arguments, regardless of the location it is run in, it will fetch the packages matching the argument(s).
Examples:
$ dub fetch vibe-d
$ dub fetch vibe-d@v0.9.0 --cache=local --recursive
When run in a project with no arguments, it will fetch all dependencies for that project. If the project doesn't have set dependencies (no dub.selections.json), it will also perform dependency resolution.
Example:
$ cd myProject && dub fetch
Note that the build, run, and any other command that need packages will automatically perform fetch, hence it is not generally necessary to run this command before any other.
β add β
Adds <packages> as dependencies.
Running dub add <package> is the same as adding <package> to the dependencies section in dub.json/dub.sdl. If no version is specified for one of the packages, dub will query the registry for the latest version. Bestie said dependency time π
β remove β
Removes a package that is cached on the local system.
β¬οΈ upgrade β¬οΈ
Upgrades all dependencies of the package by querying the package registry(ies) for new versions.
This will update the versions stored in the selections file (dub.selections.json) accordingly.
If one or more package names are specified, only those dependencies will be upgraded. Otherwise all direct and indirect dependencies of the root package will get upgraded.
π£οΈ add-path π£οΈ
Adds a default package search path. All direct sub folders of this path will be searched for package descriptions and will be made available as packages. Using this command has the equivalent effect as calling dub add-local on each of the sub folders manually.
Any packages registered using add-path will be preferred over packages downloaded from the package registry when searching for dependencies during a build operation.
The version of the packages will be determined by one of the following:
- For GIT working copies, the last tag (
git describe) is used to determine the version - If the package contains a
versionfield in the package description, this is used - If neither of those apply,
~masteris assumed
π« remove-path π«
Removes a package search path previously added with add-path.
π add-local π
Adds a local package directory to be used during dependency resolution. This command is useful for registering local packages, such as GIT working copies, that are either not available in the package registry, or are supposed to be overwritten.
The version of the package is either determined automatically (see the add-path command) or can be explicitly overwritten by passing a version on the command line.
See dub add-path -h for a way to register multiple local packages at once.
ποΈ remove-local ποΈ
Removes a local package directory.
π list π
Prints a list of all or selected local packages. This includes all cached packages (user or system wide), all packages in the package search paths (dub add-path) and all manually registered packages (dub add-local). If a package (and optionally a version spec) is specified, only matching packages are shown.
π search π
Searches all specified providers for matching packages.
β οΈ add-override β οΈ
This command is deprecated. Use path based dependency, custom cache path, or edit dub.selections.json to achieve the same results.
β οΈ remove-override β οΈ
This command is deprecated. Use path based dependency, custom cache path, or edit dub.selections.json to achieve the same results.
β οΈ list-overrides β οΈ
This command is deprecated. Use path based dependency, custom cache path, or edit dub.selections.json to achieve the same results.
π§½ clean-caches π§½
This command removes any cached metadata like the list of available packages and their latest version.
π convert π
This command will convert between JSON and SDLang formatted package recipe files.
β οΈ Warning: Beware that any formatting and comments within the package recipe will get lost in the conversion process.
β¨ COMMON OPTIONS β¨
These are the options that every single dub command understands, bestie. Learn them once, use them everywhere π
-h,--helpβ shows you the general help, or if you put it after a command, the help for that command specifically π«Ά--root=VALUEβ tells dub to go operate in this path instead of wherever you currently are (the current working dir). Like, "don't look here, look there" β¨--recipe=VALUEβ loads a custom recipe path instead of the usualdub.json/dub.sdl. Situationships with config files? handled π--registry=VALUEβ searches the given registry URL first when resolving dependencies. You can pass this multiple times, no cap. The available registry types are:DUB: URL to DUB registry (default)Maven: URL to Maven repository + group id containing dub packages as artifacts. E.g.mvn+http://localhost:8040/maven/libs-release/dubpackages
--skip-registry=VALUEβ sets the mode for skipping the search on certain package registry types:none: Search all configured or default registries (default)standard: Don't search the main registry (e.g.https://code.dlang.org/)configured: Skip all default and user configured registriesall: Only search registries specified with--registry
--annotateβ does literally nothing, just prints what would be done. It's giving "window shopping" π--bareβ only reads packages contained in the current directory. Nothing outside, periodt π-v,--verboseβ prints diagnostic output. The girlies love a little extra context π¬--vverboseβ prints debug output. Yes, that's very verbose with an extra v. It's iconic, don't question it π-q,--quietβ only prints warnings and errors. Shhh π€«--verrorβ only prints errors. Even quieter, lowkey the strictest vibe check π--vquietβ prints no messages at all. Silence. Gorgeous. Iconic πΈ--color=VALUEβ configures colored output. Accepted values:auto: Colored output on console/terminal, unlessNO_COLORis set and non-empty (default)always: Force colors enablednever: Force colors disabled
--cache=VALUEβ puts any fetched packages in the specified location. Options are[local|system|user]π
π¦ FILES π¦
dub.sdl,dub.json
These are the recipe files dub goes looking for, bestie. That's the whole list, and honestly? She ate π
π AUTHOR π
Copyright (c) 1999-2026 by The D Language Foundation
π ONLINE DOCUMENTATION π
http://code.dlang.org/docs/commandline β¨β©
Go read the docs, iykyk πβ¨
π SEE ALSO π
dmd(1),rdmd(1),dub-init(1),dub-run(1),dub-build(1),dub-test(1),dub-lint(1),dub-generate(1),dub-describe(1),dub-clean(1),dub-dustmite(1),dub-fetch(1),dub-add(1),dub-remove(1),dub-upgrade(1),dub-add-path(1),dub-remove-path(1),dub-add-local(1),dub-remove-local(1),dub-list(1),dub-search(1),dub-add-override(1),dub-remove-override(1),dub-list-overrides(1),dub-clean-caches(1),dub-convert(1)
That's the whole page, bestie, you made it to the end π This DUB(1) moment was brought to you by The D Language Foundation, dated 2026-08-16 β go forth and build something iconic ππ₯
π¦ where this page comes from
- arch rolling: dub 1.42.0-1 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms