fpm(1)
fpm is a tool for building packages in multiple formats (deb, rpm, tar, etc.) from source code, directories, or other packages.
Synopsis
fpm [options] -s input_type -t output_type [inputs...]Description
fpm (Effing Package Management) simplifies package creation by accepting input from various sources—source directories, Python packages, Ruby gems, npm modules, or existing packages—and converting them into distributable formats. It eliminates the need to learn multiple packaging tools and standardizes deployment workflows.
Common workflows include packaging application directories into .deb or .rpm files for distribution, converting between package formats, and automating package builds in CI/CD pipelines. fpm handles file permissions, dependencies, and metadata automatically, reducing boilerplate.
Common options
| Flag | What it does |
|---|---|
-s, --input-type TYPE | Input type: dir, rpm, deb, gem, python, npm, tar, zip, etc. |
-t, --output-type TYPE | Output package type: deb, rpm, tar, zip, osxpkg, etc. |
-n, --name NAME | Package name (defaults to directory name for dir input) |
-v, --version VERSION | Package version number |
-d, --depends PACKAGE | Add a package dependency (can be used multiple times) |
-m, --maintainer EMAIL | Maintainer name and email for package metadata |
-C, --chdir DIR | Change to directory before building package |
-p, --package OUTPUT | Output filename or path for the generated package |
--prefix PREFIX | Install prefix path (target installation directory) |
--after-install SCRIPT | Script to run after package installation |
--before-remove SCRIPT | Script to run before package removal |
-a, --architecture ARCH | Target architecture (x86_64, i386, all, etc.) |
Examples
Package a directory into a .deb file named myapp version 1.0
fpm -s dir -t deb -n myapp -v 1.0 -C /path/to/app .Create an RPM with a dependency on nginx, mapping src/ to installation path
fpm -s dir -t rpm -n webserver -v 2.1 -d 'nginx >= 1.10' ./src=/usr/local/webserverConvert a Ruby gem into a .deb package
fpm -s gem -t deb -n ruby-mylib my_gem_namePackage an npm module into a .deb for system-wide Node.js installation
fpm -s npm -t deb -n node-express expressCreate package with post-installation script that runs after install
fpm -s dir -t deb -n app -v 1.0 --after-install post-install.sh ./dist=/opt/appConvert an existing RPM package into .deb format
fpm -s rpm -t deb firefox-*.rpmPackage a directory into a timestamped tar.gz archive
fpm -s dir -t tar.gz -n backup -v $(date +%Y%m%d) -C /var/www .