This page contains information on how to prepare the development environment before enabling a call/live broadcast with the Agora SDK for macOS.

Prerequisites

  • Xcode 9.0+.
  • Physical OS X 10.0+.
  • Ensure that your project has a validated provisioning profile certificate.
  • Before accessing Agora’s services, ensure that you have opened the ports and whitelisted the domains as specified in Firewall Requirements.

Use a physical device to run the sample. Simulators may lack the functionality or the performance needed to run the sample.

Create an Agora Account and Get an App ID

  1. Sign up for a developer account at https://dashboard.agora.io/.

  2. Click Add New Project on the Projects page of Dashboard.

    ../_images/appid_1.jpg
  3. Fill in the Project Name and click Submit. You have created your first project at Agora.

  4. Find the App ID under the created project.

    ../_images/appid_2.jpg

Add the Agora SDK to Your Project

Choose one of the following methods to add the Agora SDK libraries to your project:

Add the Libraries Automatically

  1. Install CocoaPods by running the following command in Terminal:

    brew install cocoapods
    • Skip this step if you have preconfigured CocoaPods and Homebrew on your system.
    • If Terminal says -bash: brew: command not found, install Homebrew before running the command. See Homebrew Installation Method.
  2. Create a Podfile in your project. In the root directory of your project, run the following command in Terminal. This creates a Podfile in the same directory.

    pod init
  3. Add the Agora SDK reference in the Podfile. Open the Podfile, and put in the following content. Fill “Your App” with the name of your Target.

    platform :macOS, '10.11'
    use_frameworks!
    
    target 'Your App' do
      pod 'AgoraRtcEngine_macOS'
    end
  4. Update the local Cocoapods library. Run the following command in Terminal:

    pod update
  5. Install the related libraries.

    pod install

    If Terminal says Pod installation complete!, you have successfully added the libraries. Click to open the YourApp.xcworkspace file, or run the following command to open it. Fill “YourApp” with the name of your Target.

    open YourApp.xcworkspace

Add the Libraries Manually

  1. Download the Agora Video SDK for macOS and unzip the downloaded SDK package.

  2. Open your project with Xcode and select the current Target.

    ../_images/mac_video_1.jpg
  3. Navigate to the Build Phases tab.

    ../_images/mac_video_2.jpg
  4. Expand the Link Binary with Libraries section to add the following libraries. To begin adding the new libraries, click the + button.

    • libresolv.tbd
    • libc++.1.dylib
    • Accelerate.framework
    • SystemConfiguration.framework
    • CoreWLAN.framework
    • Foundation.framework
    • CoreAudio.framework
    • CoreMedia.framework
    • AVFoudation.framework
    • VideoToolbox.framework
    • AudioToolbox.framework
    • AgoraRtcEngineKit.framework

    Before:

    ../_images/mac_video_3.jpg

    After:

    ../_images/mac_video_4.jpg

    AgoraRtcEngineKit.framework is in the libs folder of the downloaded SDK. Click + > Add Other…, go to the downloaded SDK, and add AgoraRtcEngineKit.framework.

    ../_images/mac_video_5.jpg

Authorize the Use of the Agora SDK

Before enabling a video call, you need to enable camera and microphone access to the SDK on your device. Open info.plist and click + to add:

  • Privacy - Microphone Usage Description, and add a note in the Value column.
  • Privacy - Camera Usage Description, and add a note in the Value column.

Before:

../_images/mac_video_6.jpg

After:

../_images/mac_video_7.jpg

Access the Library

You can access the added library using Objective-C or Swift.

Objective-C

In the main file that uses the Agora APIs, add #import <AgoraRtcEngineKit/AgoraRtcEngineKit.h>.

The SDK provides FAT image libraries with multi-architecture support for both 32/64-bit audio emulators and 32/64-bit audio/video real devices.

Swift

In the main file that uses the Agora APIs, add import AgoraRtcEngineKit.

../_images/mac_video_8.jpg

Next Steps

You have now set up the macOS environment and can start a call/live broadcast following the steps under Quickstart Guide:

  • Initialize the SDK
  • Join a Channel
  • Publish and Subscribe to Streams