# info > DPKG-GENBUILDDEPS

---
type: CommandReference
command: dpkg-genbuilddeps
mode: man
section: 1
source: man-pages
---

## Quick Reference

- `dpkg-genbuilddeps [arg ...]` — run from top of a Debian build tree to generate a list of non-essential packages used during the build
- `dpkg-genbuilddeps -rfakeroot` — run under fakeroot to avoid root privileges
- `dpkg-depcheck --all dpkg-buildpackage -us -uc -b -rfakeroot` — alternative if `build-essential` is not installed

## Name

generate a list of packages used to build this package

## Synopsis

`dpkg-genbuilddeps [arg ...]`

## Description

This program is a wrapper around `dpkg-depcheck(1)`. It should be run from the top of a Debian build tree. It calls `dpkg-buildpackage` with any arguments given on the command line, and by tracing the execution determines which non-essential packages were used during the package building. This can be useful for determining the `Build-Depends` control fields. It does not determine which packages were used for arch-independent vs. arch-dependent parts, nor does it attempt to determine version requirements.

It can run under `fakeroot` (e.g., `fakeroot dpkg-genbuilddeps` or `dpkg-genbuilddeps -rfakeroot`).

This program requires the `build-essential` package to be installed. If not, use `dpkg-depcheck --all dpkg-buildpackage -us -uc -b -rfakeroot ...`

Essentially, it runs:
`dpkg-depcheck -b dpkg-buildpackage -us -uc -b -rfakeroot [arg ...]`

## Examples

- Simple invocation (with fakeroot):
  ```shell
  dpkg-genbuilddeps -rfakeroot
  
- If `build-essential` is not installed:
  ```shell
  dpkg-depcheck --all dpkg-buildpackage -us -uc -b -rfakeroot ...
  
## See Also

- `dpkg-depcheck(1)` ([man page](https://manpages.debian.org/dpkg-depcheck.1))
- `fakeroot(1)` ([man page](https://manpages.debian.org/fakeroot.1))
- The Debian Policy Manual, sections on Build-Depends etc.

## Exit Codes

Not documented.