Вы находитесь на странице: 1из 10


BSD General Commands Manual


port -- operate on individual or multiple Mac _____ ports SYNOPSIS port [-bcdfknopqRstuvy] [-D _______] [-F _______] [______] [___________] - portdir - cmdfile action actionflags [[________ _______________ ________]] portname pseudo-portname port-url [[________] [+/-variant ...] ... [option=value ...]] @version DESCRIPTION port is designed to operate on individual or multiple Mac _____, optionports ally within a single call, based on the requested ______. If no _______ action portdir or ________ is specified, the current working directory is assumed; if no portname action ______ is specified the port command enters interactive mode, in which commands are read via stdin. Batch commands may be passed via a _______. cmdfile Port _______ are passed as key=value pairs and take precedence over indioptions vidual ________ options as specified in its Portfile and system-wide setportname tings. Port ________ can specified as _____, which indicates the variant is variants +name desired, or _____, indicating the contrary. In case of ambiguities, a -name port can be fully specified with the __________________________ format. @version revision+variants Installed ports can be activated or deactivated without being uninstalled. A port can be installed if all other version/variant(s) combinations installed at any given moment are deactivated. The port command knows various ________________ that will expand to the pseudo-portnames specified set of ports from the available ports tree(s). These may be used in place of a ________. Common options are: portname o + o + o + o + o + o + o + o + o + o + o + o + all ___: all the ports in each ports tree listed in ____________ sources.conf current _______: the port in the current working directory. active ______: set of installed and active ports. inactive ________: set of installed but inactive ports. actinact ________: set of installed ports that have both an active version and one or more inactive versions. installed _________: set of all installed ports. uninstalled ___________: ports in the ports tree(s) that aren't installed. outdated ________: installed ports that are out of date with respect to their current version/revision in the ports tree(s) obsolete ________: set of ports that are installed but no longer exist in any port tree requested _________: installed ports that were explicitly asked for. unrequested ___________: installed ports that were installed only to satisfy dependencies. leaves ______: installed ports that are unrequested and have no dependents.

Sets of ports can also expand to the ports in to the selector's name ble) matches the given

be specified with _______________ _________, which pseudo-portname selectors which the value of the ________ key corresponding Portfile (in either singular or plural form where applicaregular expression. Usage is: ______________ selector:regex

Available selectors are: o + o + o + o + o + o + o + o + o + o + o + o + o + o + o + o + name ____ version _______ revision ________ epoch _____ variant _______ variants ________ category ________ categories __________ maintainer __________ maintainers ___________ platform ________ platforms _________ description ___________ long description ________________ homepage ________ portdir _______

Other pseudo-portname selectors match ports which have a particular relationship to another port. These will match ports that are direct or recursive dependencies or dependents of the given portname: o + o + o + o + depof _____ rdepof ______ dependentof ___________ rdependentof ____________

portnames _________ containing valid UNIX glob patterns will also expand to the set of matching ports. Any ______ passed to port will be invoked on each of action them. For example: port port port port list variant:no_ssl uninstall name:sql echo depof:mysql5 echo apache*

Logical operators "and", "or", "not", "!", "(" and ")" may be used to combine individual _________, port glob patterns and/or ________________ portnames pseudo-portnames to construct complex port expressions that expand to the set of matching ports. For example: port upgrade installed and apache* port echo maintainer:jberry and uninstalled and \( category:java and not commons* \) The port command also recognizes several command line flags and _______: targets OPTIONS -v -d -q verbose mode (generate verbose messages) debug mode (generate debugging messages, implies -v) quiet mode (suppress messages)

-n -R -u -f -o -s -b -c -k -D -F

don't upgrade dependencies (affects upgrade and install) also upgrade dependents (only affects upgrade) - note that this does not upgrade dependents' dependencies uninstall non-active ports when upgrading and uninstalling force mode (ignore state file) honor state files older than Portfile source-only mode (build and install from source, do not attempt to fetch binary archives) binary-only mode (build and install from binary archives, ignore source, abort if no archive available) autoclean mode (execute clean after install) keep mode (don't autoclean after install) specify _______ portdir Read and process the ____ of commands specified by the argument. file If the argument is '-', then read commands from stdin. If the option is given multiple times, then multiple files will be read. Despite any errors encountered, proceed to process multiple ports and commands. Perform a dry run. All of the steps to build the ports and their dependencies are computed, but not actually performed. With the verbose flag, every step is reported; otherwise there is just one message per port, which allows you to easily determine the recursive deps of a port (and the order in which they will be built). enable trace mode debug facilities on platforms that support it (Mac OS X). This feature is two-folded. It consists in automatically detecting and reporting undeclared dependencies based on what files the port reads or what programs the port executes. In verbose mode, it will also report unused dependencies for each stage of the port installation. It also consists in forbidding and reporting file creation and file writes outside allowed directories (temporary directories and ${workpath}).

-p -y


USER TARGETS Targets most commonly used by regular MacPorts users are: search Search for an available port. By default, the search string is treated as a case-insensitive glob, and is matched against the name and description fields. To have the search string treated as a regular expression, as a literal, or in a case-sensitive manner, use --regex, --exact, or --case-sensitive, respectively. To match against a different set of fields, use one or more --<field-name> options. To display each result on a single line, use --line. For example:

port search vim port search --regex --depends_build 'docbook.*[0-9]+' info Displays meta-information available for ________. Specific meta-informaportname tion may be requested through an option such as --maintainer or --category (recognized field names are those from the PortIndex, see "port help info" for a complete list). If no specific fields are specified, a useful default collection of fields will be displayed. If the global option -q is in effect, the meta-info fields will not be labeled. If the option --line is provided, all such data will be consolidated into a single line per port, suitable for processing in a pipe of commands. If the option --pretty is provided, the information will be formatted in a somewhat more attractive fashion for human readers. This is the default when no options at all are specified to info. If the option --index is provided, the information will be pulled from the PortIndex rather than from the Portfile (in this case variant information, such as dependencies, will not affect the output). For example: port info vim +ruby port info --category --name apache* port -q info --category --name --version category:java port info --line --category --name all port info --pretty --fullname --depends gtk2 port info --index python24 notes Displays notes for ________ (useful information concerning setup and use portname of the port). variants Lists the build variants available for ________. portname deps Lists the other ports that are required to build and run ________. This portname is simply an alias for "info --pretty --fullname --depends". rdeps Recursively lists the other ports that are required to build and run portname ________. To display the full dependency tree instead of only showing each port once, use --full. To take dependency information from the PortIndex instead of the Portfile (faster, but does not take variant selections into account), use --index. To exclude dependencies that are only needed at build time (i.e. depends_fetch, depends_extract, depends_build), use --no-build. dependents Lists the installed ports that depend on the port ________. portname rdependents Recursively lists the installed ports that depend on the port ________. portname To display the full tree of dependents instead of only showing each port once, use --full. install Install and activate ________. portname uninstall Deactivate and uninstall ________. To uninstall all installed but inacportname

tive ports, use -u. To recursively uninstall all dependents of ________ portname before uninstalling the port itself, use --follow-dependents. To uninstall ________ and then recursively uninstall all its dependencies, use portname --follow-dependencies. This will not uninstall dependencies that are marked as requested or that have other dependents. For example: port uninstall vim port -u uninstall port uninstall --follow-dependents python24 select For a given _____, selects a _______ to be the default by creating approgroup version priate symbolic links. For instance, python might be linked to python2.6. Available select groups are installed as subdirectories of ${prefix}/etc/select/ _____________________. To list the available versions in a group, use --list. To see which version is currently selected for a group, use --show. To change the selected version for a group, use --set. For example: port select --list python port select --show gcc port select --set gcc mp-gcc44 activate Activate the installed ________. portname deactivate Deactivate the installed ________. portname setrequested Mark ________ as requested. portname unsetrequested Mark ________ as unrequested. portname installed Show the installed versions and variants for ________. If no ________ is portname portname given, all installed ports are shown. location Print the install location of a given port. contents Lists the files installed by ________. portname provides Determines which port owns a given file and can take either a relative or absolute path. For example: port provides /opt/local/etc/irssi.conf port provides include/tiff.h sync Performs a sync operation only on the ports tree of a MacPorts installation, pulling in the latest revision available of the _________ from the Portfiles MacPorts rsync server. To update you would normally do:

sudo port -d sync If any of the ports tree(s) uses a file: URL that points to a local subversion working copy, sync will perform an svn update on the working copy with the user set to the owner of the working copy. outdated List the installed ports that need upgrading. upgrade The upgrade target works on a port and its dependencies. If you want to change this behaviour, look at the switches for n (no dependencies) and R (dependents) below. Upgrade the installed ________. For example: portname port upgrade vim To upgrade all installed ports: port upgrade installed To upgrade ________ and the ports that depend on it: portname port -R upgrade libiconv To force an upgrade (rebuild) use: port upgrade --force vim To upgrade ________ without following its dependencies, use -n. For portname example: port -n upgrade wireshark Note that in selecting the variants to use in the upgraded build of the port, any variants specified on the command line take highest precedence, then the variants active in the latest installed version of the port, and finally the global variants specified in variants.conf, if any. Note that upgrade will not normally rebuild a port only to change the selected variants; you can either specify --enforce-variants, or deactivate the port and reinstall it with different variants. clean Clean the files used for building ________. To just remove the work portname files, use the --work __________. This is the default when no flag is actionflag given. To remove the distribution files (tarballs, etc), specify --dist. To remove the work files, distribution files and logs, pass --all. To remove log files for certain port, pass --logs. For example: port clean --dist vim port clean --logs vim log Parses and shows log files for ________. To filter log files by some portname criterions use --phase to specify phase you want to show and --verbosity to specify message category (msg, info, debug) For example: port log --phase configure vim port log --phase fetch --verbosity debug vim

echo Writes to stdout the arguments passed to port. This follows the expansion of ________________, portname glob patterns, _______________ pseudo-portnames pseudo-portname selectors _________ and the evaluation of port expressions. echo may be used to determine the exact set of ports to which a given string of arguments will expand, without performing any further operations on them. For example: port echo category:net port echo maintainer:jmpp and name:netw port echo maintainer:jmpp and \( net* or category:text \) list If no argument is given, display a list of the latest version of all available ports. If portname(s) are given as arguments, display a list of the latest version of each port. mirror Create/update a local mirror of distfiles used for ports given on the command line. The filemap database can be reset by using the --new option (though if no database is found, it will be created automatically). If the fetched file does not match the checksum given in the Portfile, it is deleted. This can be used with ________________, eg, pseudo-portnames all ___, to mirror everything. Note that if you use ___, you'll most likely all want to use -p so port doesn't quit on the first download failure. version Display the release number of the installed MacPorts infrastructure. platform Display the platform information for the current system. selfupdate Updates the MacPorts system, ports tree(s) and base tools if needed, from the MacPorts rsync server, installing the newest infrastructure available. To update you would typically do: sudo port selfupdate See sync for more information about updating ports tree(s). load Provides a shortcut to using launchctl to load a port's daemon (as installed in /Library/LaunchDaemons). It runs: launchctl load -w /Library/LaunchDaemons/org.macports.${port}.plist unload A shortcut to launchctl, like load, but unloads the daemon. gohome Loads the home page for the given ________ in the default web browser. portname usage Displays a condensed usage summary. help Displays a summary of all available actions and port command syntax on stdout.

DEVELOPER TARGETS The targets that are often used by Port developers are intended to provide access to the different phases of a Port's build process: dir Displays the path to the directory containing ________. portname work Displays the path to the work directory for ________. portname cd Changes the current working directory to the one containing ________. portname Only useful in interactive mode. file Displays the path to the Portfile for ________. portname url Displays the URL for the path of the given ________, which can be passed portname as port-url cat Concatenates and prints the contents of ________ on stdout. Portfile edit Opens ________ with your default editor specified in your shell's enviPortfile ronment variable. Alias __ also invokes this command. ed You can also use the --editor flag on the command line to specify an alternative editor. For example: port edit --editor nano apache2 ed An alias for edit. fetch Fetches the distribution files required to build ________. portname checksum Compute the checksums of the distribution files for ________, and compare portname them to the checksums listed in ________. Portfile extract Extracts the distribution files for ________. portname patch Applies any required patches to __________ extracted distribution files. portname's configure Runs any configure process for ________. portname build Build ________. portname destroot Installs ________ to a temporary directory. portname test Tests ________. portname

lint Verifies Portfile for ________. To nitpick about whitespace and patchportname file names, use --nitpick. distcheck Check if the distfiles haven't changed and can be fetched. distfiles Display each distfile, its checksums, and the URLs used to fetch it. livecheck Check if the software hasn't been updated since the Portfile was last modified. PACKAGING TARGETS There are also targets for producing installable packages of ports: pkg Creates an OS X installer package of _________ portname. mpkg Creates an OS X installer metapackage of ________ and its dependencies. portname dmg Creates an internet-enabled disk image containing an OS X package of portname ________. mdmg Creates an internet-enabled disk image containing an OS X metapackage of portname ________ and its dependencies. rpm Creates an RPM binary package of ________, similar to a tgz "archive". portname srpm Creates a SRPM source package of ________, similar to a xar "portpkg". portname dpkg Creates a DEB binary package of ________. portname EXAMPLES The following demonstrates invoking port with the _______ target on extract portdir _______ "textproc/figlet" and extract.suffix set to ".tgz": port extract -D textproc/figlet extract.suffix=.tgz FILES ${prefix}/etc/macports/macports.conf ____________________________________ Global configuration file for the MacPorts system. ${prefix}/etc/macports/sources.conf ___________________________________ Global listing of the ports trees used by MacPorts. This file also enables rsync synchronization. ${prefix}/etc/macports/variants.conf ____________________________________ Global variants used when a port is installed. ~/.macports/macports.conf _________________________ User configuration file for the MacPorts system. It overrides the

global _____________ file. macports.conf DIAGNOSTICS The port utility exits 0 on success, and >0 if an error occurs. SEE ALSO macports.conf(5), portfile(7), portgroup(7), portstyle(7), porthier(7) AUTHORS Landon Fuller <landonf@macports.org> James Berry <jberry@macports.org> Jordan K. Hubbard <jkh@macports.org> Juan Manuel Palacios <jmpp@macports.org> Kevin Van Vechten <kevin@opendarwin.org> Ole Guldberg Jensen <olegb@opendarwin.org> Robert Shaw <rshaw@opendarwin.org> Chris Ridd <cjr@opendarwin.org> Matt Anton <matt@opendarwin.org> Joe Auty <joe@opendarwin.org> BSD April 29, 2007 BSD