DUB-FETCH(1)

πŸ’… DUB-FETCH(1) β€” the D Language Foundation's little package-grabber ✨

okay so bestie, welcome to dub-fetch, brought to you by The D Language Foundation. this is the page where we learn how to explicitly retrieve and cache packages. no cap, it's lowkey the most straightforward one in the whole dub family, and i'm obsessed. πŸŽ€


✨ NAME ✨

dub-fetch β€” explicitly retrieves and caches packages, fr fr 🫢


🌸 SYNOPSIS 🌸

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

that's it. that's the shape of it. package, optional version spec, options. slay. πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

okay so picture this: when you run it with one or more arguments, regardless of the location it is run in β€” like, doesn't matter where you're standing, doesn't matter what directory you're in β€” it will fetch the packages matching the argument(s).

examples, because i love a demo:

$ dub fetch vibe-d
$ dub fetch vibe-d@v0.9.0 --cache=local --recursive

see? iconic. run it anywhere and it just does the thing. 🧚


now, the other mode. when you run it in a project with no arguments, it will fetch all dependencies for that project. so basically "hey dub, go get everything this project needs" and it goes and gets it. main character energy honestly. πŸ‘‘

and if that project doesn't have set dependencies (i.e. there's no 'dub.selections.json'), it will also perform dependency resolution. extra step, but she's thorough.

example:

$ cd myProject && dub fetch

πŸ’€ real talk though: the build, run, and any other command that need packages will automatically perform fetch. so it is not generally necessary to run this command before any other. she'll do it herself. she's got you. 🫢

πŸ’– OPTIONS πŸ’–

  • -r, --recursive β€” also fetches dependencies of specified packages. yes, the dependencies' dependencies. she goes deep. 🌈
  • --version=VALUE β€” use the specified version/branch instead of the latest available match. and listen, the remove command also accepts "*" here as a wildcard to remove all versions of the package from the specified location. iykyk. ⭐
  • --force-remove β€” deprecated option that does nothing. it's giving "was invited to the party but contributes nothing." it does nothing. truly nothing. don't @ me. πŸ™ˆ

πŸŽ€ COMMON OPTIONS πŸŽ€

see dub(1) for those, bestie. all the shared stuff lives over there. πŸ’œ


⭐ EXIT STATUS ⭐

  • 0 β€” DUB succeeded. we love a happy ending. πŸ₯³
  • 1 β€” usage errors, unknown command line flags. someone typed a thing that isn't a thing. 😭
  • 2 β€” package not found, package failed to load, miscellaneous error. the "miscellaneous" is doing a lot of heavy lifting here ngl. πŸ’€

🌷 FILES 🌷

  • dub.sdl
  • dub.json

🌟 AUTHOR 🌟

Copyright (c) 1999-2026 by The D Language Foundation 🫢


πŸ”₯ ONLINE DOCUMENTATION πŸ”₯

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

go read it, she's got lore. ✨


🌈 SEE ALSO 🌈


okay that's the whole page, you ate that. πŸ’…βœ¨ and a cute little sign-off for the record: this masterpiece was served up by The D Language Foundation on 2026-08-16. periodt. πŸŽ€πŸ¦‹πŸ’–

πŸ“¦ where this page comes from