5 stars based on
MacPorts is an easy to use system for compiling, install binary macports, and managing open source software. MacPorts may be conceptually divided into two main parts: A MacPorts port is a set of specifications contained in a Portfile that defines an application, its characteristics, and any files or special instructions required to install it.
This allows you to use a single command to tell MacPorts to automatically download, compile, and install applications and libraries. But using MacPorts to manage your open source install binary macports provides several other significant advantages.
Installs automatically any required support software, known as dependenciesfor a given port. Allows you to create pre-compiled binary install binary macports of ported applications to quickly install software on remote computers without compiling from source code. In practice, installing ports only works on macOS. MacPorts base can be compiled on Linux and possibly other POSIX-compatible systems where it is mainly used to set up mirrors and generate support files for installations on macOS.
This chapter shows you how to install MacPorts and its prerequisites step-by-step. Note that the section about installing Xcode is macOS-specific. Install binary macports you wish to install MacPorts on another platform, first make sure you have a install binary macports C compiler installed, skip ahead to installing MacPorts from sourceand continue to the end of the chapter.
Xcode is a package provided by Apple containing compilers, libraries and additional tools required to develop applications for macOS. Always make sure to install the latest available version of Xcode for your macOS release; using outdated versions of Xcode may cause port install failures. Download the latest version of Xcode from the Apple developer website or get it using the Mac App Store.
Once you have Xcode installed, open a terminal, run xcode-select --installand click the Install button to install the required command line developer tools. Don't worry if you see a message telling you the software cannot be installed because it is not currently available from the Software Update Server.
This usually means you already have the latest version installed. You can also get the command line tools from the Apple developer website. To install them, open the Xcode application, go to the Preferences window, to the Downloads section, and click the Install button next to Command Line Tools.
Be sure to return to this window after every Xcode upgrade to ensure that the command line tools are also upgraded. If you are using Mac OS X Xcode 4 costs money, but Xcode 3 is still available free of charge. There are two options for downloading it:. Note that Apple might at some point discontinue providing these updates via their update servers. Both are available from the Apple developer website. You may also be able to install Install binary macports 3.
Ensure that those of the following options that are available in the installer for your version of Xcode are selected:. However, if you wish to install multiple copies of MacPorts or install MacPorts on another OS platform, you must install MacPorts from the source code.
The macOS package installer automatically installs MacPorts, sets the shell environmentand runs a selfupdate operation to update the ports tree and MacPorts base with the latest release. Download the latest MacPorts Here are direct links for the latest versions of macOS:.
After this install binary macports you are done already, MacPorts is now installed and your shell environment was set up automatically by the installer. To confirm the installation is working as expected, now try using port in a new terminal window. If you installed MacPorts using the install binary macports installer, skip this section.
To install MacPorts from the source code, follow the steps below. Download and extract the MacPorts 2. Either do so using your browser and the Finder, or use the given commands in a terminal window.
Afterwards, perform the commands shown in the terminal window. There are times when some may want to run MacPorts from a version newer than the current stable release. Maybe there's a new feature that you'd like to use, or it fixes an issue you've encountered, or you just like to be on the cutting edge. These steps explain how to setup MacPorts for developers, using only Git to keep MacPorts up to date.
Though a distinction is made between pre-release and release versions of MacPorts install binary macports, the ports collection supports no such distinction or versioning. The selfupdate command installs the install binary macports ports tree, and updates MacPorts base to the latest released version.
Pick a location to store a working copy of the MacPorts code. MacPorts uses autoconf and makefiles for installation. You can add --prefix to. The last line should look like this:. Now MacPorts will look for portfiles in the working copy and use Git instead of rsync to update your ports tree.
Occasionally a MacPorts developer may wish install binary macports install more than one MacPorts instance on the same host. The first command temporarily removes the standard MacPorts binary paths because they must not be present while installing a second instance.
MacPorts base upgrades are performed automatically when a newer release is available during a selfupdate operation. To upgrade a copy of MacPorts that was installed from source install binary macports the newer release of the source code, simply repeat the source install with the newer version of the MacPorts source code. Uninstalling MacPorts can be a drastic step, and depending on the issue you are experiencing, you may not need to do so.
If you are unsure, ask on the macports-users mailing list first. If you need to uninstall MacPorts, and port is functioning, first uninstall all the installed ports by running this command in the Terminal:. All that will be left in your installation prefix now will be files that were not registered to any port.
This includes configuration files, databases, any files which MacPorts renamed in order to allow a forced installation or upgrade, and the base MacPorts software itself. To remove all remaining traces of MacPorts, run the following command in install binary macports Terminal.
If you use a shell other than bash perhaps tcsh install binary macports, you may need to adjust the above to fit your shell's syntax. Also note that depending on which version of MacPorts you have and which ports install binary macports have installed, install binary macports all of the above paths will exist on your system.
MacPorts requires that some environment variables be set in the shell. Those installing MacPorts from source code must modify their environment manually using the rules as a guide.
Depending install binary macports your shell and which configuration files already exist, the installer may use. This variable is set by the postflight script to prepend the MacPorts executable paths to the current path as shown. To change the search path for locating system executables rsync, tar, etc. But changing this variable is for advanced users only, and is not generally needed or recommended. If installing on a Mac OS X version earlier than To verify that the file containing the MacPorts variables is in effect, type env in the terminal install binary macports verify the current environment settings after the file has been created.
Example output for env is shown below. Changes to shell configuration files do not take effect until a install binary macports terminal session is opened. You can set an environment variable in order to use your favorite text editor with the port edit command. To keep a command-line text editor as default while using BBEdit with portfiles, add this:.
This chapter describes using portport variants, common tasks and port binaries. It is used to update Portfile s and the MacPorts install binary macports, and install and manage ports. The help action shows some brief information about the specified action, or if no action is specified, shows basic usage information for port in general. The selfupdate action should be used regularly to update the local ports tree with the global MacPorts ports repository so you will have the latest versions of software install binary macports available.
It also checks for new releases of MacPorts itself, and upgrades it when necessary. If selfupdate detects install binary macports a newer version of MacPorts is available, it automatically updates the installed copy of MacPorts base to the latest released version. In that case, you will see this message:. As always, you can use the debug flag -d to enable verbose output. If your selfupdate failed, re-run it with debug output enabled to see all output generated by the build system.
The output may give you an idea why the build failed. The sync action performs a subset of selfupdate. Install binary macports synchronizes the ports tree, as does selfupdatebut it install binary macports not check for MacPorts upgrades. On macOS, unless there is a special reason not to do so, run selfupdate instead. The diagnose action checks for common issues in the user's environment and reports all issues it finds to the user, along with possible fixes for said problem.
The reclaim action attempts to reclaim space by uninstalling inactive ports, and removing unnecessary files install binary macports were downloaded during the installation process. The list action lists the currently available version of the specified ports, or if no ports are specified, displays a list of all available ports.
The list of available ports is very long, so use search if you are looking for a specific port. For this reason, port list installed likely produces unexpected output.
In most cases where you would listusing installed or echo is the better choice instead. Both port installed and port echo installed would produce the output you might expect from the command, port list installed will not and, to make matters worse, will be slow. You will hardly need port list at all to work with MacPorts.
When searching, port search is the better choice and when trying to list ports, port installed and port echo are much more install binary macports. The search action allows finding ports by partial matches of the name or description.
Other fields can be matched against, and matched in different ways, by using options. We recommend you read up on some of its flags to improve your efficiency when searching for ports.
Run install binary macports help search for an exhaustive list of possible switches.