images

# MacPorts Port Images

## About this chapter

This chapter provides an overview of the MacPorts Port Image model of installing and using ports for users of MacPorts. A more complete overview of Port Images can be found in the MacPorts Internals part of this Guide.

## What Are Port Images?

Port Images are a new model for installing and using your ported software. At the most basic level, Port Images are a solution to the problem of needing or wanting multiple different versions, revisions, and/or variants of the same port installed at the same time. This is accomplished by installing the port into a repository location and then create links, or aliases, from that repository location into the `${prefix}` from where you can use the MacPorts ports.

Port Images provide the ability to test new versions of a port, or different variants of a port, without having to uninstall a previous and/or working version of that port. This is accomplished using one of the key concepts of Images: activation.

## Port Image Activation

With Port Images in MacPorts, the port is installed as an image to the MacPorts image repository. This repository can be thought of as an library of ports that actually contains all of the files belonging to that port. Once the port is installed as an image, the port can be activated.

Activation simply creates the links into the `${prefix}` of MacPorts. MacPorts manages any conflicts between any ports that are activated, and will inform you if one port is attempting to link a file that already exists and belongs to another port. You have the option to force MacPorts to go ahead and activate the port in the event of a conflict, and MacPorts will continue, moving the old file out of the way.

By default, MacPorts will go ahead and activate a port when you run `port install vim`. Once a port is installed and activated, you can deactivate, in addition to uninstalling it. If you wish to move one port out of the way of another port or another variant or version of the same port, you can deactivate it. When you do this, the port is still installed in the image repository, but simply not linked into `${prefix}`.

## Using Port Images

MacPorts uses Port Images by default now, so if you are using a recent release of MacPorts, you are using Port Images! Port Images will work transparently for users used to the old installation model of MacPorts, as well as those familiar with other port systems. If you wish to use the advanced features that Port Images provide, namely activation and deactivation, the following commands are available:

`port installed vim`

  This command will list all installed versions and variants of the `vim` port. You can use this command to find the version string the port if you have multiple versions installed and wish to activate or deactivate one version.

`port activate vim`

  This command will activate the `vim` port. If there are multiple versions of the `vim` port installed, you will need to provide the version string of the port you wish to activate.

`port activate vim @6.2.532+gtk2`

  This command will activate the specific version of the `vim` given using the version string. This is how you activate one version of a port out of two or more installed versions of that port.

`port deactivate vim`

  This command will deactivate the `vim` port. If there are multiple versions of the `vim` port installed, you will need to provide the version string of the port you wish to deactivate.

`port deactivate vim @6.2.532+gtk2`

  This command will deactivate the specific version of the `vim` given using the version string. This is how you deactivate one version of a port out of two or more installed versions of that port.

`port location vim`

  This command will simply give you the full path to the image location where the `vim` port is installed. If you have more than one version or variants of a single port installed, you can specify the version string of the port as the last argument, similar to the above examples of activation and deactivation.