# macports – Package manager for MacPorts

- Synopsis
- Parameters
- Examples
- Status

## Synopsis

- Manages MacPorts packages (ports)

## Parameters

Parameter | Choices/Defaults | Comments
--- | --- | ---
name - |  | A list of port names. aliases: port

selfupdate
boolean

Choices:
- no ←
- yes

Update Macports and the ports tree, either prior to installing ports or as a separate step.
Equivalent to running `port selfupdate`.
aliases: update_cache, update_ports

state
-

Choices:
- present ←
- absent
- active
- inactive

Indicates the desired state of the port.

upgrade
boolean
added in 2.8

Choices:
- no ←
- yes

Upgrade all outdated ports, either prior to installing ports or as a separate step.
Equivalent to running `port upgrade outdated`.

variant - added in 2.7 |  | A port variant specification. `variant` is only supported with state: installed/present. aliases: variants

## Examples

    - name: Install the foo port
      macports:
        name: foo

    - name: Install the universal, x11 variant of the foo port
      macports:
        name: foo
        variant: +universal+x11

    - name: Install a list of ports
      macports:
        name: "{{ ports }}"
      vars:
        ports:
        - foo
        - foo-tools

    - name: Update Macports and the ports tree, then upgrade all outdated ports
      macports:
        selfupdate: yes
        upgrade: yes

    - name: Update Macports and the ports tree, then install the foo port
      macports:
        name: foo
        selfupdate: yes

    - name: Remove the foo port
      macports:
        name: foo
        state: absent

    - name: Activate the foo port
      macports:
        name: foo
        state: active

    - name: Deactivate the foo port
      macports:
        name: foo
        state: inactive

## Status

- This module is not guaranteed to have a backwards compatible interface. [preview]
- This module is maintained by the Ansible Community. [community]

### Authors

- Jimmy Tang (@jcftang)

Hint

If you notice any issues in this documentation, you can edit this document to improve it.