HOME

TheInfoList



OR:

MacPorts, formerly DarwinPorts, is a
package manager A package manager or package-management system is a collection of software tools that automates the process of installing, upgrading, configuring, and removing computer programs for a computer in a consistent manner. A package manager deals wi ...
for
macOS macOS (; previously OS X and originally Mac OS X) is a Unix operating system developed and marketed by Apple Inc. since 2001. It is the primary operating system for Apple's Mac computers. Within the market of desktop and lapt ...
and Darwin. It is an
open-source software Open-source software (OSS) is computer software that is released under a license in which the copyright holder grants users the rights to use, study, change, and distribute the software and its source code to anyone and for any purpose. Op ...
project that aims to simplify the installation of other open source software. It's similar in function to Fink and the BSD
ports collection Ports collections (or ''ports trees'', or just ''ports'') are the sets of makefiles and patches provided by the BSD-based operating systems, FreeBSD, NetBSD, and OpenBSD, as a simple method of installing software or creating binary packages. T ...
s. MacPorts allows the installation of a number of packages by entering the command sudo port install ''packagename'' in the
Terminal Terminal may refer to: Computing Hardware * Terminal (electronics), a device for joining electrical circuits together * Terminal (telecommunication), a device communicating over a line * Computer terminal, a set of primary input and output dev ...
, which will then download, compile if necessary, and install the requested software, while also installing any required dependencies automatically. Installed packages can be updated with the command sudo port upgrade outdated. MacPorts supports universal binaries for PowerPC, Intel-based, and
Apple silicon Apple silicon is a series of system on a chip (SoC) and system in a package (SiP) processors designed by Apple Inc., mainly using the ARM architecture. It is the basis of most new Mac computers as well as iPhone, iPad, iPod Touch, Apple TV, ...
versions of
macOS macOS (; previously OS X and originally Mac OS X) is a Unix operating system developed and marketed by Apple Inc. since 2001. It is the primary operating system for Apple's Mac computers. Within the market of desktop and lapt ...
, but migrating from a PowerPC installation of MacPorts to a version on an Intel Mac requires reinstalling all installed ports.


Usage


Updating Software

There are three main usage modes of port that assist in updating installed software: * sync updates the local ports tree. It doesn't upgrade any installed packages, but instead retrieves information about new and updated software. It's similar in function to brew update or apt update. * selfupdate has the same functionality as sync but also updates the MacPorts system. In most cases, this should be used in preference to just running sync by itself, and it's recommended to run this each time before using MacPorts. * upgrade upgrades any installed ports and its dependencies to the latest version found in the local ports tree. It's similar in function to apt upgrade. As an example, one common task is to update outdated ports. This can be done by running the following: sudo port selfupdate sudo port upgrade outdated MacPorts supports
logical operators In logic, a logical connective (also called a logical operator, sentential connective, or sentential operator) is a logical constant. They can be used to connect logical formulas. For instance in the syntax of propositional logic, the binary c ...
such as ''and'', ''or'' and ''not,'' as well as glob patterns (enabled by default) and
regex A regular expression (shortened as regex or regexp; sometimes referred to as rational expression) is a sequence of characters that specifies a search pattern in text. Usually such patterns are used by string-searching algorithms for "find" or ...
(enabled via --regex). For instance, to update outdated ports excluding all
PHP PHP is a general-purpose scripting language geared toward web development. It was originally created by Danish-Canadian programmer Rasmus Lerdorf in 1993 and released in 1995. The PHP reference implementation is now produced by The PHP Group. ...
versions, change the above command to the following: sudo port selfupdate sudo port upgrade outdated and not php*


Installing Software

Users can indicate one or more packages that they wish to install via the install mode, and MacPorts will aim to install them and its dependencies. For example, both
LibreOffice LibreOffice () is a free and open-source productivity software, office productivity software suite, a project of The Document Foundation (TDF). It was fork (software development), forked in 2010 from OpenOffice.org, an open-sourced version of t ...
and
Texmaker Texmaker is a cross-platform open-source LaTeX editor with an integrated PDF viewer. It is entirely a Qt app. Texmaker supports Linux, macOS and Windows systems and integrates many tools needed to develop documents with LaTeX. Features Th ...
can be installed by running the following: sudo port install libreoffice texmaker Note that this will install the latest version as indicated by the local ports tree. Running selfupdate beforehand will make sure that the downloaded package is the newest version in MacPorts.


Variants

Variants provide different options that may be invoked when installing a port. Common actions include adding or removing dependencies and changing build arguments. They provide additional functionality that might not necessarily be useful for all users, but can be useful for others. For instance, the
youtube-dl youtube-dl is a free and open source download manager for video and audio from YouTube and over 1,000 other video hosting websites. It is released under the Unlicense software license. As of September 2021, youtube-dl is one of the most starred ...
port provides an
ffmpeg FFmpeg is a free and open-source software project consisting of a suite of libraries and programs for handling video, audio, and other multimedia files and streams. At its core is the command-line ffmpeg tool itself, designed for processing of vid ...
variant that is enabled by default. In return for adding two extra dependencies, this then allows for audio to be extracted. Variants can be included or removed using the + or - symbols, so the ffmpeg variant can be disabled by running the following: sudo port install youtube-dl -ffmpeg Multiple variants can be listed one after another by separating them with a space. As an example, it's possible to disable the default prefork MPM in the apache2 port in favour of worker MPM: sudo port install apache2 -preforkmpm +workermpm The variants of a port can be determined by running port variants ''packagename'', or by searching for the port on the MacPorts website.


Frontends


Website

The MacPorts Ports website was implemented during
Google Summer of Code The Google Summer of Code, often abbreviated to GSoC, is an international annual program in which Google awards stipends to contributors who successfully complete a free and open-source software coding project during the summer. , the program is ...
2019, with major UI improvements made within the same program in 2020. It displays information about individual ports, such as installation statistics and build-history. These statistics are also available via an
API An application programming interface (API) is a way for two or more computer programs to communicate with each other. It is a type of software interface, offering a service to other pieces of software. A document or standard that describes how ...
. Users can optionally login to be notified when a port has been updated. There is also a separate MacPorts homepage, that provides information on the project as well as instructions on how to install it.


History

MacPorts was started in 2002 with the involvement of a number of
Apple Inc. Apple Inc. is an American multinational technology company headquartered in Cupertino, California, United States. Apple is the largest technology company by revenue (totaling in 2021) and, as of June 2022, is the world's biggest company ...
employees, including Landon Fuller, Kevin Van Vechten, and
Jordan Hubbard Jordan K. Hubbard (born April 8, 1963) is an open source software developer, authoring software such as the Ardent Window Manager and various other open source tools and libraries before co-founding the FreeBSD project with Nate Williams and Rodn ...
. It was originally known as DarwinPorts, with the name coming from Darwin and
FreeBSD Ports The FreeBSD Ports collection is a package management system for the FreeBSD operating system, providing an easy and consistent way of installing software packages. As of February 2020, there are over 38,487 ports available in the collection. It has ...
. It began as part of the
OpenDarwin Darwin is an open-source Unix operating system first released by Apple Inc. in 2000. It is composed of code derived from NeXTSTEP, BSD, Mach, and other free software projects' code, as well as code developed by Apple. Darwin forms the Unix ...
project, with its aim to help users on macOS and Darwin to install
Unix Unix (; trademarked as UNIX) is a family of multitasking, multiuser computer operating systems that derive from the original AT&T Unix, whose development started in 1969 at the Bell Labs research center by Ken Thompson, Dennis Ritchie, and ot ...
software. OpenDarwin was shut down in 2006. DarwinPorts was then hosted on Mac OS Forge, an open source hosting service created and maintained by
Apple Inc. Apple Inc. is an American multinational technology company headquartered in Cupertino, California, United States. Apple is the largest technology company by revenue (totaling in 2021) and, as of June 2022, is the world's biggest company ...
for third-party projects not supported by Apple. So as to indicate the project's emphasis on macOS, its name was changed to MacPorts. When Apple closed Mac OS Forge in 2016, the project moved to GitHub. As part of this change,
git Git () is a distributed version control system: tracking changes in any set of files, usually used for coordinating work among programmers collaboratively developing source code during software development. Its goals include speed, data in ...
was used as the new
version control system In software engineering, version control (also known as revision control, source control, or source code management) is a class of systems responsible for managing changes to computer programs, documents, large web sites, or other collections o ...
, although
Trac Trac is an open-source, web-based project management and bug tracking system. It has been adopted by a variety of organizations for use as a bug tracking system for both free and open-source software and proprietary projects and products. Tra ...
was still preferred for ticket management over GitHub issues. Version 1.0 was released on April 28, 2005. In December 2005 the project reached a milestone, surpassing 3000 ports. At that time, package installation involved the source code being downloaded and compiled on the end user's machine. Version 2.0, released in 2011, introduced support for prebuilt binary archives; by default ports are installed using the prebuilt binary archive if available, and are built from source otherwise. , MacPorts has over 29,900 ports and best-effort support can be sourced from the community.


Implementation

MacPorts installs software on top of the
operating system An operating system (OS) is system software that manages computer hardware, software resources, and provides common services for computer programs. Time-sharing operating systems schedule tasks for efficient use of the system and may also in ...
, providing newer versions of pre-installed packages or software that isn't included in macOS. This is in contrast to other package management systems, such as
APT Apt. is an abbreviation for apartment. Apt may also refer to: Places * Apt Cathedral, a former cathedral, and national monument of France, in the town of Apt in Provence * Apt, Vaucluse, a commune of the Vaucluse département of France * A ...
and DNF, that are part of the operating system. For this reason, MacPorts is sometimes known as an overlay distribution. Other examples include Fink and Homebrew. In contrast to the FreeBSD Ports Collection, which installs its software in /usr/local, MacPorts stores its data in /opt/local by default, although this can be modified when compiling MacPorts from source. The reason given for this change is that other packaging systems could overwrite what MacPorts has installed, or vice versa. A dedicated directory helps to overcome this problem. Fink follows a similar approach, installing its data into /sw by default.


Binary Archives

Buildbot Buildbot is a software development continuous integration tool which automates the compile or test cycle required to validate changes to the project code base. It began as a light-weight alternative to the Mozilla project's Tinderbox, and is now ...
s are used to build ports in advance so that users do not have to compile the package locally. The result of this is known as a binary archive, and it helps to reduce the time required for installation. Similar to Homebrew, MacPorts takes the approach of having different builders for different operating system versions and architectures. However, sometimes it might be necessary to build from source locally if the binaries fail to build or the port's license does not allow binary distribution. If a binary could not be built, this would be noted on the MacPorts website for that individual port and the maintainer would be alerted. It's also possible to view recent buildbot events on a dedicated activity page. Binary archives are created locally whenever a user builds a port from source. They can also be manually created by running sudo port archive ''packagename''.


Portfiles

MacPorts stores the instructions required to build a port in a port description file, otherwise known as a portfile. This is similar to how the AUR use
shell Shell may refer to: Architecture and design * Shell (structure), a thin structure ** Concrete shell, a thin shell of concrete, usually with no interior columns or exterior buttresses ** Thin-shell structure Science Biology * Seashell, a hard o ...
scripts known as a PKGBUILD, or how Homebrew use
ruby A ruby is a pinkish red to blood-red colored gemstone, a variety of the mineral corundum ( aluminium oxide). Ruby is one of the most popular traditional jewelry gems and is very durable. Other varieties of gem-quality corundum are called sa ...
scripts as a formula. The portfiles are complete TCL programs with access to the TCL interpreter. They make use of simple ''key value'' pair options to define attributes. For example, this is the portfile for
Hashcat Hashcat is a password recovery tool. It had a proprietary code base until 2015, but was then released as open source software. Versions are available for Linux, OS X, and Windows. Examples of hashcat-supported hashing algorithms are LM hashes, MD ...
: # -*- coding: utf-8; mode: _tcl; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- vim:fenc=utf-8:ft=tcl:et:sw=2:ts=2:sts=2 PortSystem 1.0 PortGroup github 1.0 PortGroup makefile 1.0 github.setup hashcat hashcat 6.2.3 v github.tarball_from archive categories security license MIT platforms darwin maintainers @gaming-hacker openmaintainer description World's fastest and most advanced password recovery utility. long_description hashcat is the world's fastest and most advanced \ password recovery utility, supporting five unique modes \ of attack for over 200 highly-optimized hashing algorithms. \ hashcat currently supports CPUs, GPUs, and other hardware \ accelerators on Linux, Windows, and macOS, and has \ facilities to help enable distributed password cracking homepage https://hashcat.net/hashcat/ build.target checksums rmd160 8bb501834a320aaac3de149c5ab39c2eb89ee968 \ sha256 c0be1c6693ee1f35c7bef1f79bf9e30a954f717ef42d00e37787aaeff3271e51 \ size 6222424 Each portfile has pre-defined stages that can be manually configured via the portfile. These include the following: Fetch First, MacPorts retrieves and downloads all the relevant files for the port from
upstream Upstream may refer to: * Upstream (bioprocess) * ''Upstream'' (film), a 1927 film by John Ford * Upstream (networking) * ''Upstream'' (newspaper), a newspaper covering the oil and gas industry * Upstream (petroleum industry) * Upstream (software ...
. These are known as distfiles. In the case of hashcat, these files are retrieved from
GitHub GitHub, Inc. () is an Internet hosting service for software development and version control using Git. It provides the distributed version control of Git plus access control, bug tracking, software feature requests, task management, continuous ...
. They are removed, along with temporary build files, when the installation is complete. Checksum
Checksum A checksum is a small-sized block of data derived from another block of digital data for the purpose of detecting errors that may have been introduced during its transmission or storage. By themselves, checksums are often used to verify data ...
s are always defined within the portfile, since they're different for different files. The checksums of the downloaded files are compared to those in the portfile to see whether they match. Only one compressed file is downloaded for Hashcat, so only one checksum is required in the portfile. Patch Sometimes, the code might need to be modified to make it installable via MacPorts. This could be for a variety of reasons, such as it installing in the wrong location by default.
Patch Patch or Patches may refer to: Arts, entertainment and media * Patch Johnson, a fictional character from ''Days of Our Lives'' * Patch (''My Little Pony''), a toy * "Patches" (Dickey Lee song), 1962 * "Patches" (Chairmen of the Board song) ...
files can be used to modify the source code in a readable format. In the above portfile, Hashcat does not require any changes to the code for the installation to work. Hence, there are no patch files required. When patches are required, the patch file would be stored with the portfile, and it would be referenced like the following (from
wget GNU Wget (or just Wget, formerly Geturl, also written as its package name, wget) is a computer program that retrieves content from web servers. It is part of the GNU Project. Its name derives from "World Wide Web" and " ''get''." It supports dow ...
): patchfiles prefix.patch Configure The project's
configure script A configure script is an executable script designed to aid in developing a program to be run on a wide number of different computers. It matches the libraries on the user's computer, with those required by the program before compiling it from its ...
is run to prepare for the build process. Part of this involves determining whether the required
libraries A library is a collection of materials, books or media that are accessible for use and not just for display purposes. A library provides physical (hard copies) or digital access (soft copies) materials, and may be a physical location or a vir ...
are present. For ports that do not have a configure script, this stage (as well as others when required) can be disabled. Since the configure stage is not referenced in the Portfile, hashcat is using the default configure setup as defined by MacPorts. This involves running the configure script via ./configure. Build The instructions in the portfile are then used to build the port. The commands that are executed can vary for different
languages Language is a structured system of communication. The structure of a language is its grammar and the free components are its vocabulary. Languages are the primary means by which humans communicate, and may be conveyed through a variety of met ...
. The portfile for hashcat shows that it should be treated as a
Makefile In software development, Make is a build automation tool that automatically builds executable programs and libraries from source code by reading files called ''Makefiles'' which specify how to derive the target program. Though integrated develo ...
project. It will therefore be built by running make. Test Some ports define a test to verify that the build has succeeded. This is an optional phase that is only run if the user executes port test ''packagename''. It's therefore not executed when installing a port. This hashcat port has not defined a test stage. When defined, it might look like the following (from
ImageMagick ImageMagick, invoked from the command line as magick, is a free and open-source cross-platform software suite for displaying, creating, converting, modifying, and editing raster images. Created in 1987 by John Cristy, it can read and write ove ...
): test.run yes test.target check test.env DYLD_LIBRARY_PATH=$/magick/.libs Destroot The destroot stage is the first step in moving the built files into the correct location. MacPorts takes the approach of first staging the installation into an intermediate location (destroot) before placing the files in their correct positions (install). One advantage of this is that it makes it easy to record what files were created, allowing them to be cleanly uninstalled. As an example, a file that would normally be installed to /opt/local/lib/libfoo.a might first be installed to /tmp/stage/opt/local/lib/libfoo.a during the destroot stage, maintaining the relative directory structure. For hashcat, this is done by running make install, where one of the arguments (DESTDIR) specifies where to temporarily store the files. Note that in the majority of scenarios, only the stages below occur on the user's machine. This is because
binaries A binary file is a computer file that is not a text file. The term "binary file" is often used as a term meaning "non-text file". Many binary file formats contain parts that can be interpreted as text; for example, some computer document fil ...
for the ports are pre-built so that they do not need to be built from source locally. Install The destrooted files are archived safely. Since these files have not been activated yet, this allows for multiple different versions of the same port to be archived without interfering with each other. Activate When activating a port, the files in the destroot directory are moved to their correct location. This makes them accessible to the user, completing the installation process. If they wish to try a different version of the port, they can deactivate their current version and activate the new one. This does not uninstall the old port since it can easily be activated again from the archived files. When upgrading a port, MacPorts deactivates but does not uninstall the current version as a safety feature. This allows the user to easily revert to the old version if the update causes breaking changes.


Development

Packages are the responsibility of individual maintainers, who are mentioned within the portfile. They are expected to update the port and apply bug-fixes where required. Anybody who wants to modify a portfile should alert the maintainer before applying the changes, although this isn't always required for minor modifications. Anyone is able to contribute to MacPorts, generally via pull requests, and contributors can apply for commit rights following a good track record as a maintainer. A team of MacPorts members, known as the project managers, help to lead and coordinate the project. Starting from 2016, meetings have occasionally been held once a year. They normally take place in
Slovenia Slovenia ( ; sl, Slovenija ), officially the Republic of Slovenia (Slovene: , abbr.: ''RS''), is a country in Central Europe. It is bordered by Italy to the west, Austria to the north, Hungary to the northeast, Croatia to the southeast, an ...
, and allow for MacPorts members to work on future development.


Data collection

By default, MacPorts does not collect any statistics. However, users can optionally submit information by running sudo port install mpstats. This sends details once a week on which ports are installed, as well as various system properties. The information is then used to determine which hardware to support and to understand how quickly new MacPorts releases are adopted. Users can view analytics data on the MacPorts website.


See also

* Fink *
Gentoo/Alt Portage is a package management system originally created for and used by Gentoo Linux and also by ChromeOS, Calculate, Sabayon, and Funtoo Linux among others. Portage is based on the concept of ports collections. Gentoo is sometimes referre ...
* Homebrew *
Nix Nix or NIX may refer to: Places * Nix, Alabama, an unincorporated community, United States * Nix, Texas, a ghost town in southwestern Lampasas County, Texas, United States * Nix (moon), a moon of Pluto People * Nix (surname), listing people with ...
*
pkgsrc pkgsrc (''package source'') is a package management system for Unix-like operating systems. It was forked from the FreeBSD ports collection in 1997 as the primary package management system for NetBSD. Since then it has evolved independently; in 19 ...
*
FreeBSD Ports The FreeBSD Ports collection is a package management system for the FreeBSD operating system, providing an easy and consistent way of installing software packages. As of February 2020, there are over 38,487 ports available in the collection. It has ...
*
Ports collection Ports collections (or ''ports trees'', or just ''ports'') are the sets of makefiles and patches provided by the BSD-based operating systems, FreeBSD, NetBSD, and OpenBSD, as a simple method of installing software or creating binary packages. T ...


References


External links

*
MacPorts Guide

The MacPorts Wiki

List of available ports
{{DEFAULTSORT:Macports Console applications Free package management systems Free software programmed in Tcl Software using the BSD license Utilities for macOS