> ## Documentation Index
> Fetch the complete documentation index at: https://mintlify.com/FunkinCrew/Funkin/llms.txt
> Use this file to discover all available pages before exploring further.

# Mac Compilation Guide

> Additional considerations when compiling Friday Night Funkin' for macOS

When compiling Friday Night Funkin' for macOS, there are several extra considerations for creating production-ready builds.

<Note>
  Before following this guide, make sure you've completed the [basic compilation setup](/development/compiling).
</Note>

## Mac-Specific Considerations

When creating a wider release for macOS, the Funkin' Crew handles several additional steps:

* Creating Universal Binaries (ARM64 + x86\_64)
* Code-signing the application
* Notarizing with Apple

## Creating a Universal Binary

A Universal Binary allows your game to run natively on both Intel (x86\_64) and Apple Silicon (ARM64) Macs.

### Using the Build Script

The easiest way to create a Universal Binary is to use the included build script:

```bash theme={null}
./art/macos-universal.sh
```

This script automatically:

1. Compiles a release build for ARM64
2. Compiles a release build for x86\_64
3. Combines both into a Universal Binary

### Manual Universal Binary Creation

If you want to understand the process or customize it, here's what the script does:

<Steps>
  <Step title="Build for ARM64">
    Compile the game for Apple Silicon:

    ```bash theme={null}
    lime build mac -release -arm64
    ```
  </Step>

  <Step title="Build for x86_64">
    Compile the game for Intel Macs:

    ```bash theme={null}
    lime build mac -release -64
    ```
  </Step>

  <Step title="Combine the binaries">
    Use the `lipo` command to merge both architectures:

    ```bash theme={null}
    lipo -create \
      export/release/mac/bin/Funkin-arm64 \
      export/release/mac/bin/Funkin-x86_64 \
      -output export/release/mac/bin/Funkin
    ```
  </Step>

  <Step title="Verify the Universal Binary">
    Check that both architectures are present:

    ```bash theme={null}
    lipo -info export/release/mac/bin/Funkin
    ```

    Expected output:

    ```
    Architectures in the fat file: Funkin are: x86_64 arm64
    ```
  </Step>
</Steps>

## Code Signing

<Warning>
  Code signing requires an Apple Developer account (\$99/year).
</Warning>

To distribute your Mac build outside the Mac App Store, you need to sign it with your Apple Developer certificate:

```bash theme={null}
codesign --force --deep --sign "Developer ID Application: Your Name (TEAM_ID)" \
  export/release/mac/bin/Funkin.app
```

### Verify Code Signing

Check that your app is properly signed:

```bash theme={null}
codesign --verify --verbose export/release/mac/bin/Funkin.app
```

## Notarization

Notarization is Apple's process of scanning your app for malicious software. Users will see warnings if your app isn't notarized.

<Steps>
  <Step title="Create an app-specific password">
    Generate an app-specific password in your [Apple ID account](https://appleid.apple.com).
  </Step>

  <Step title="Create a ZIP of your app">
    ```bash theme={null}
    ditto -c -k --keepParent export/release/mac/bin/Funkin.app Funkin.zip
    ```
  </Step>

  <Step title="Submit for notarization">
    ```bash theme={null}
    xcrun notarytool submit Funkin.zip \
      --apple-id "your@email.com" \
      --team-id "TEAM_ID" \
      --password "app-specific-password" \
      --wait
    ```
  </Step>

  <Step title="Staple the notarization ticket">
    Once notarization succeeds, attach the ticket to your app:

    ```bash theme={null}
    xcrun stapler staple export/release/mac/bin/Funkin.app
    ```
  </Step>
</Steps>

## Build Script Reference

The `art/macos-universal.sh` script contains the complete build process used by the Funkin' Crew. You can examine it to understand the full production build pipeline:

```bash theme={null}
# View the build script
cat art/macos-universal.sh
```

## Platform Setup

For initial Mac platform setup, refer to Lime's official documentation:

<Card title="Lime macOS Setup" icon="book" href="https://lime.openfl.org/docs/advanced-setup/macos/">
  Official guide for setting up Lime on macOS
</Card>

## Common Mac Build Issues

<AccordionGroup>
  <Accordion title="Architecture Mismatch Errors">
    If you see errors about architecture mismatches, ensure you're building with the correct architecture flag:

    * Apple Silicon: Use `-arm64` or `-DHXCPP_ARM64`
    * Intel: Use `-64` or `-DHXCPP_M64`
  </Accordion>

  <Accordion title="Xcode Command Line Tools Missing">
    Install Xcode Command Line Tools:

    ```bash theme={null}
    xcode-select --install
    ```
  </Accordion>

  <Accordion title="Code Signing Issues">
    Verify your certificates are installed:

    ```bash theme={null}
    security find-identity -v -p codesigning
    ```

    You should see your "Developer ID Application" certificate listed.
  </Accordion>
</AccordionGroup>

## Next Steps

<CardGroup cols={2}>
  <Card title="General Compilation" icon="hammer" href="/development/compiling">
    Return to the main compilation guide
  </Card>

  <Card title="Troubleshooting" icon="wrench" href="/development/troubleshooting">
    Fix common compilation issues
  </Card>

  <Card title="Contributing" icon="code-pull-request" href="/development/contributing">
    Learn how to contribute code
  </Card>

  <Card title="Style Guide" icon="palette" href="/development/style-guide">
    Follow code conventions
  </Card>
</CardGroup>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.