DUB-BUILD(1)

πŸ’… DUB-BUILD(1) β€” the D Language Foundation's own build command, explained by your favorite terminal gremlin

okay so bestie, welcome to dub-build(1), fresh from The D Language Foundation. This is the page for dub build β€” the command that actually builds your package. And yes, by default it uses the main package sitting in your current working directory, like it just knows where you live. main character energy fr fr πŸŽ€


✨ SYNOPSIS ✨

dub build [<package>[@<version-spec>]] OPTIONS...

that's it. that's the whole vibe. package optional, version-spec optional, options go brrr πŸ¦‹


🌸 DESCRIPTION 🌸

Builds a package. Uses the main package in the current working directory by default. no cap, that's the entire description and honestly? iconic. short, sweet, to the point πŸ’–


πŸ”₯ OPTIONS πŸ”₯

  • --temp-build β€” builds the project in the temp folder if possible. cozy little temp-dir era ✨
  • --rdmd β€” use rdmd instead of directly invoking the compiler. delegation queen πŸ‘‘
  • -f, --force β€” forces a recompilation even if the target is up to date. not me rebuilding something that's already fine πŸ’€
  • -y, --yes β€” automatic yes to prompts. assumes "yes" as the answer to all interactive prompts. trust the process πŸ™ˆ
  • -n, --non-interactive β€” don't enter interactive mode. antisocial mode: activated 🫢
  • --deep β€” build all dependencies, even when the main target is a static library. go deep or go home 🌈
  • --dest=VALUE β€” base directory in which output atifacts will be placed. (yes, "atifacts" β€” I don't make the spelling rules, I just report them 😭)
  • -b, --build=VALUE β€” specifies the type of build to perform. ⚠️ heads up: setting the DFLAGS environment variable will override the build type with custom flags. the possible names are:
debug, plain, release, release-debug, release-nobounds, unittest,
profile, profile-gc, docs, ddox, cov, cov-ctfe, unittest-cov,
unittest-cov-ctfe, syntax and custom types

so many flavors, pick your fighter πŸ“

  • -c, --config=VALUE β€” builds the specified configuration. configurations can be defined in dub.json. very customizable, very demure πŸ’œ
  • --override-config=VALUE β€” uses the specified configuration for a certain dependency. can be specified multiple times. format is --override-config=<dependency>/<config> β€” slash-separated, bestie, don't forget the slash 🌸
  • --compiler=VALUE β€” specifies the compiler binary to use (can be a path). arbitrary pre- and suffixes to the identifiers below are recognized (e.g. ldc2 or dmd-2.063) and matched to the proper compiler type:
dmd, gdc, ldc, gdmd, ldmd

it's giving options, and I'm obsessed ✨

  • -a, --arch=VALUE β€” force a different architecture (e.g. x86 or x86_64). architecture? we changing it πŸ’…
  • -d, --debug=VALUE β€” define the specified debug version identifier when building. can be used multiple times. stack 'em up 🧚
  • --d-version=VALUE β€” define the specified version identifier when building. can be used multiple times. ⚠️ use sparingly β€” with great power comes great responsibility! for commonly used or combined versions, and versions that dependees should be able to use, create configurations in your package instead. fr fr, do it the clean way πŸ’€
  • --nodeps β€” do not resolve missing dependencies before building. we're rawdogging the dependency graph apparently πŸ™ˆ
  • --build-mode=VALUE β€” specifies the way the compiler and linker are invoked. valid values:
separate (default), allAtOnce, singleFile

separate is the default, in case you were wondering πŸ‘€

  • --single β€” treats the package name as a filename. the file must contain a package recipe comment. one file, one destiny πŸ¦‹
  • --force-remove β€” deprecated option that does nothing. it's literally just vibes at this point πŸ’€
  • --filter-versions β€” [Experimental] filter version identifiers and debug version identifiers to improve build cache efficiency. experimental means experimental, bestie πŸ§ͺ
  • --combined β€” tries to build the whole project in a single compiler run. efficiency slay πŸ”₯
  • --print-builds β€” prints the list of available build types. I love a list πŸŽ€
  • --print-configs β€” prints the list of available configurations. another list, we stay winning ✨
  • --print-platform β€” prints the identifiers for the current build platform as used for the build fields in dub.json. know your platform, love your platform 🌈
  • --parallel β€” runs multiple compiler instances in parallel, if possible. multitasking icon πŸ‘‘

πŸ’– COMMON OPTIONS πŸ’–

see dub(1) β€” the mothership has the shared deets, iykyk 🫢


⭐ EXIT STATUS ⭐

  • 0 β€” DUB succeeded. we love a win 🌸
  • 1 β€” usage errors, unknown command line flags. oops 😭
  • 2 β€” package not found, package failed to load, miscellaneous error. the "miscellaneous" is doing so much heavy lifting there πŸ’€

πŸŽ€ FILES πŸŽ€

  • dub.sdl
  • dub.json

your recipe files, your whole personality basically πŸ’…


πŸ‘‘ AUTHOR πŸ‘‘

Copyright (c) 1999-2026 by The D Language Foundation. legends, honestly 🌟


πŸ¦‹ ONLINE DOCUMENTATION πŸ¦‹

http://code.dlang.org/docs/commandline ⟨⟩

go read the docs, bestie, they're free ✨


πŸ’œ SEE ALSO πŸ’œ

dub(1), dub-run(1), dub-test(1), rdmd(1)

the whole friend group, go say hi 🫢


and that's the whole page, bestie β€” brought to you by The D Language Foundation, dated 2026-08-16, in the DUB-BUILD(1) era. go build something iconic πŸŽ€πŸ’–βœ¨

πŸ“¦ where this page comes from