Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
PKG-CREATE(8)		     System Manager's Manual		   PKG-CREATE(8)

NAME
     pkg create -- a utility for creating software package distributions

SYNOPSIS
     pkg create [-enqv] [-f format] [-l level] [-o outdir] [-p plist]
	 [-r rootdir] [-t timestamp] [-T threads] -m metadatadir
     pkg create [-enqv] [-f format] [-l level] [-o outdir] [-r rootdir]
	 [-t timestamp] [-T threads] -M manifest
     pkg create [-egnqvx] [-f format] [-l level] [-o outdir] [-r rootdir]
	 [-t timestamp] [-T threads] pkg-name ...
     pkg create [-enqv] [-f format] [-l level] [-o outdir] [-r rootdir]
	 [-t timestamp] [-T threads] -a

     pkg create [--expand-manifest] [--no-clobber] [--quiet] [--verbose]
	 [--format format] [--level level] [--out-dir outdir] [--plist plist]
	 [--root-dir rootdir] --metadata metadatadir
     pkg create [--expand-manifest] [--no-clobber] [--quiet] [--verbose]
	 [--format format] [--level level] [--out-dir outdir]
	 [--root-dir rootdir] --manifest manifest
     pkg create [--expand-manifest] [--{glob,no-clobber,regex}] [--quiet]
	 [--verbose] [--format format] [--level level] [--out-dir outdir]
	 [--root-dir rootdir] pkg-name ...
     pkg create [--expand-manifest] [--no-clobber] [--quiet] [--verbose]
	 [--format format] [--level level] [--out-dir outdir]
	 [--root-dir rootdir] --all

DESCRIPTION
     pkg  create  is  used  to	create packages from binaries or other files in-
     stalled on your computer.	Package tarballs can be created from  the  files
     of  a  previously	installed  package using metadata from the local package
     database.	Any number of packages may be created in one invocation of  this
     style.

     Alternatively,  a single package can be created from an arbitrary selection
     of files on your system, but this requires  a  metadatadir  and  optionally
     plist  to be supplied.  The package name will be derived from the +MANIFEST
     file which must be contained within the metadatadir, or passed as the argu-
     ment to -M.

     Packages thus created can be  distributed	and  subsequently  installed  on
     other machines using the pkg add command.

OPTIONS
     The following options are supported by pkg create:

     -M manifest, --manifest manifest
		     Read  all	of  the package metadata from the manifest file.
		     This is exactly the  same	format	as  +MANIFEST  mentioned
		     above,  but  any  file  name can be used, and no other file
		     will be used to read package metadata from.  If  specified,
		     only  a single package will be created.  This option is in-
		     compatible with the -m, -a, -g or -x options.

     -T threads      threads represents the number of threads to use during  the
		     compression  of  the  archive.   Set it to "0" or "auto" to
		     have pkg create detect the  number  of  CPUs  and	use  one
		     thread per CPU.

     -a, --all	     Create package tarballs from all packages installed on your
		     system.   This option is incompatible with the -g, -x or -m
		     metadatadir options.

     -e, --expand-manifest
		     The manifest contained in pkg will be expanded to	readable
		     UCL format.

     -f format, --format format
		     Set  format  as  the package compression format.  It can be
		     one of tzst, txz, tbz, tgz or tar which are  currently  the
		     only  supported  formats.	If an invalid format, or no for-
		     mat, is specified then tzst is assumed.  (The  .pkg  exten-
		     sion is used for all compression types.)

     -h, --hash      Append  a short hash of the package contents to the package
		     filename.	This can be used in combination with -s to  cre-
		     ate symlinks between the hashed and regular filenames.

     -g, --glob      Interpret pkg-name as a shell glob pattern and create pack-
		     age  only for installed binaries whose name match this pat-
		     tern.  This option is incompatible with the -a,  -x  or  -m
		     metadatadir options.

     -l level, --level level
		     Set  the compression level for created packages.  It can be
		     any valid numeric compression level you  might  specify  to
		     the underlying compression format.  Additionally, level may
		     be  one of the special words "fast" or "best".  If level is
		     one of these special words, the fastest or slowest compres-
		     sion level, respectively,	for  the  specified  compression
		     format, is used.

     -m metadatadir, --metadata metadatadir
		     Specify  the  directory  containing  the  package manifest,
		     +MANIFEST and optionally two other files; one containing  a
		     message  to be displayed on package installation, +DISPLAY,
		     and another containing the  description  for  the	package,
		     +DESC.   If  specified,  only a single package will be cre-
		     ated.  +DISPLAY and +DESC are not required;  the  +MANIFEST
		     file  can	contain  all  the required information needed to
		     build a package.  This option is incompatible with the  -M,
		     -a, -g or -x options.

     -n, --no-clobber
		     Do not overwrite already existing packages.

     -o outdir, --out-dir outdir
		     Set  outdir as the output directory.  If this option is not
		     given, all created packages will be saved	in  the  current
		     directory.

     -p plist, --plist plist
		     Specify some package metadata using the legacy plist format
		     from  pkg_add(1),	commonly found in pkg-plist files in the
		     ports tree.  Metadata from the plist  file,  if  specified,
		     will   take   precedence  over  any  equivalents  from  the
		     metadatadir.   Only  has  any   effect   when   used   with
		     metadatadir.  See "PLIST FORMAT" for details.

     -q, --quiet     Force   quiet   output.	This   is  the	default,  unless
		     PKG_CREATE_VERBOSE is set to yes in pkg.conf.

     -r rootdir, --root-dir rootdir
		     rootdir specifies the top-level directory to be treated  as
		     the root of the filesystem hierarchy containing the package
		     files.   File  paths in generated packages will be relative
		     to rootdir.  This allows a package  to  be  generated  from
		     content  offset from its intended final location, which al-
		     lows a package building without disturbing similar  content
		     already  on the system.  If unspecified, the default is ef-
		     fectively /, the actual root directory.

     -t timestamp, --timestamp
		     Set the timestamp of the files within the archive.

     -v, --verbose   Force verbose output, the opposite of --quiet.

     -x, --regex     Like -g, but interpret pkg-name as a regular expression us-
		     ing the "modern" or "extended" syntax described in  re_for-
		     mat(7).   This option is incompatible with the -a, -g or -m
		     metadatadir options.

MANIFEST FILE DETAILS
     name pkg-name
	  This entry sets the package's name to pkg-name.  Among  other  things,
	  this	name  is used - with the version and the origin of the concerned
	  package - to identify a dependency.

     version pkg-version
	  This entry sets the package's version to pkg-version.

     origin pkg-origin
	  This entry sets the package's origin to pkg-origin.  This is a  string
	  of  the  form category/port-dir which designates the port this package
	  was built from.

     comment comment-string
	  comment-string is a one-line description of this package.  It  is  the
	  equivalent  of  the COMMENT variable for a port, not a way to put com-
	  ments in a +MANIFEST file.

     desc description
	  description is a longer description of the package.  It is the equiva-
	  lent of the pkg-descr file for a port.  It may be one to a  few  para-
	  graphs.  For example:

		desc = <<EOD
		   This is a longer description of the package.
		   It can span multiple lines.

		   It can also span multiple paragraphs.
		EOD

     arch cpu-type
	  The  architecture  of  the machine the package was built on.	cpu-type
	  takes values like x86, amd64...

     www url
	  The software's official website.

     maintainer mail-address
	  The maintainer's mail address.

     prefix path-prefix
	  The path where the files  contained  in  this  package  are  installed
	  (usually /usr/local).

     flatsize size
	  The  size that the files contained in this package will occupy on your
	  system once uncompressed.  This value does not take into account files
	  stored in the package database.

     deps dep-name dep-origin dep-version
	  Associative array of package dependencies, keyed on dep-name and  with
	  values version dep-version and origin dep-origin.  For example:

		"deps" : {
		   "pstree" : {
		      "version" : "2.36",
		      "origin" : "sysutils/pstree"
		   },
		   "cdiff" : {
		      "version" : "0.9.6.20140711,1",
		      "origin" : "textproc/cdiff"
		   },
		},

     conflict pkg-glob
	  Flag this package as incompatible with the one designated by pkg-glob.
	  Conflicting  packages  cannot  be installed on the same system as they
	  may contain references to the same files.

     option option-name option-value
	  Set the option option-name to the value option-value.

     file sha256-hash path
	  file entries list files included in the package.  If	the  file  is  a
	  regular  one,  such an entry contains its sha256 digest along with its
	  path.  If a packaged file is a link, you must use this  entry's  other
	  form, as described below.

     file - path
	  Same	as above but for file links.  The sha256 hash is replaced with a
	  - (dash).

     dir path
	  Mimics the file entry but for directories.

PLIST FORMAT
     The following describes the plist format:

     The plist is a sequential list of lines which can have keywords  prepended.
     A	keyword  starts with an `@'.  Lines not starting with a keyword are con-
     sidered as paths to a file.  If started with a `/' then it is considered an
     absolute path.  Otherwise the file is considered as relative to PREFIX.

     Keyword lines are formed as follows: @keyword line

     Available keywords are the following:

     @cwd [directory]
	     Set the internal directory pointer to point to directory.	All sub-
	     sequent filenames will be assumed relative to this directory.
     @mode mode
	     Set default permission for  all  subsequently  extracted  files  to
	     mode.   Format  is the same as that used by the chmod command.  Use
	     without an arg to set back to default (mode of the file while being
	     packed) permissions.
     @owner user
	     Set default ownership for all subsequent files to user.  Use  with-
	     out an arg to set back to default (root) ownership.
     @group group
	     Set default group ownership for all subsequent files to group.  Use
	     without an arg to set back to default (wheel) group ownership.
     @comment string
	     The line will be ignored when packing.
     @dir name
	     Declare  directory  name  to  be deleted at deinstall time.  By de-
	     fault, most directories  created  by  a  package  installation  are
	     deleted  automatically when the package is deinstalled, so this di-
	     rective is only needed for empty directories or directories outside
	     of PREFIX.  These directives should appear at the end of the  pack-
	     age list.	If the directory is not empty a warning will be printed,
	     and  the  directory will not be removed.  (Subdirectories should be
	     listed before parent directories.)
     @include name
	     Include the name plist file to the plist  currently  being  parsed.
	     the  name	will  be  opened relatively to the main plist file being
	     parsed.  Note: only one level of @include is allowed

ESCAPE SEQUENCES
ENVIRONMENT
     The following environment variables affect the  execution	of  pkg  create.
     See pkg.conf(5) for further description.

     PKG_DBDIR

     PLIST_KEYWORDS_DIR

     PORTSDIR

     SOURCE_DATE_EPOCH
		      Set  the timestamp for every single file in the archive to
		      the one specified in the environment variable

FILES
     See pkg.conf(5).

EXAMPLES
     Create package files for installed packages:
	   % pkg create -a -o /usr/ports/packages/All

     Create package file for pkg:
	   % pkg create -o /usr/ports/packages/All pkg

SEE ALSO
     pkg_create(3), pkg_printf(3),  pkg_repo_create(3),  pkg_repos(3),	pkg-key-
     words(5),	pkg-lua-script(5),  pkg-repository(5),	pkg-script(5), pkg-trig-
     gers(5), pkg.conf(5), pkg(8),  pkg-add(8),  pkg-alias(8),	pkg-annotate(8),
     pkg-audit(8), pkg-autoremove(8), pkg-check(8), pkg-clean(8), pkg-config(8),
     pkg-delete(8), pkg-fetch(8), pkg-help(8), pkg-info(8), pkg-install(8), pkg-
     key(8),  pkg-lock(8),  pkg-plugins(8),  pkg-query(8), pkg-register(8), pkg-
     repo(8),  pkg-repositories(8),  pkg-rquery(8),  pkg-search(8),  pkg-set(8),
     pkg-shell(8), pkg-shlib(8), pkg-ssh(8), pkg-stats(8), pkg-triggers(8), pkg-
     unregister(8),  pkg-update(8),  pkg-updating(8),  pkg-upgrade(8),	pkg-ver-
     sion(8), pkg-which(8)

FreeBSD ports 15.1		December 13, 2025		   PKG-CREATE(8)

Want to link to this manual page? Use this URL:
<https://man.freebsd.org/cgi/man.cgi?query=pkg-create&manpath=FreeBSD+15.1-RELEASE+and+Ports>

home | help