Helix Core is now P4. Product user interfaces will be updated soon. Learn more >>

P4 API for Go Documentation | 2025.2

# Integrate P4 API for Go on macOS

To integrate P4 API for Go on macOS, follow these steps:

- Download the relevant files

- Build OpenSSL libraries

- Configure build flags

## Download the relevant files

Download P4 API for Go from either the Perforce website or GitHub.

To integrate P4 API for Go on macOS, you need the correct version of P4 API for C/C++ and to create pre built binaries for OpenSSL.

For macOS, the P4 API for C/C++ file to download is called `p4api-openssl<SSLVER>.tgz` where:

- <SSLVER> is the OpenSSL version number.

For example, for OpenSSL 3, you would need the following P4 API for C/C++ version: `p4api-openssl3.tgz`.

To find the OpenSSL version installed on your system, open the terminal and enter `openssl version`.

If you are Integrating P4 API for Go 2025.1, search the `r25.1` directory in the Perforce archive to find the version of P4 API for C/C++ to download.

In this example, the version of P4 API for C/C++ for macOS is found in the following location:

`https://ftp.perforce.com/perforce/r25.1/bin.macosx12u/p4api-openssl3.tgz`

## Build OpenSSL libraries

When you have the relevant version of P4 API for C/C++, ensure that you have pre-built binaries that are tailored for your specific platform. On macOs, ensure that the `libssl-dev` package is installed. OpenSSL libraries can be found in your `lib` directory. For example, if you installed OpenSSL using Homebrew, find the library in `/opt/homebrew/lib`.

## Configure build flags

Configure the following build flags in the terminal.

Copy

    1
    2
    go env -w CGO_CPPFLAGS="-I<absolute path to P4 API for C++>/include -g"
    go env -w CGO_LDFLAGS="-L<absolute path to P4 API for C++>/lib -L<OpenSSLPath> -lp4api -lssl -lcrypto -framework ApplicationServices -framework Foundation -framework Security"

Replace:

- `<OpenSSLPath>` with the absolute path to OpenSSL libraries matching the P4 API for C/C++.

- `<absolute path to P4 API for C++>` with the absolute path to the P4 API for C/C++

Your search for returned results