How to Build an IPA for a React Native/Expo project without an Apple Dev Account

A comprehensive guide on building an IPA for React Native apps without an Apple Developer account, covering essential tools like Xcode and a Mac.

Introduction

Building an iOS application package (.ipa) for your React Native project typically requires an Apple Developer account and a Mac with Xcode installed. This guide will walk you through the process of generating an IPA file, even if you don't have an active Apple Developer Program membership. While an Apple Developer account is eventually needed for App Store submission, you can still build and test your app on physical devices for development purposes.

Prerequisites

It's important to note that this process might take a little longer and you may encounter more errors than a standard build process with a full Apple Developer account. Before you begin, ensure you have Xcode installed on your Mac. You can download it directly from the App Store. If you are running a macOS beta version, you will need to download Xcode-beta from Apple's official developer website.

Building the IPA

  1. Download Xcode: Download Xcode from the Mac App Store.

    If you are on MacOS beta, then you need to download Xcode-beta from Apple's website

  2. Open Your Xcode Project: Open the Xcode Project by clicking Open Existing Project and navigating to your project's ios directory to select the .xcworkspace file (e.g., YourProjectName.xcworkspace). This is crucial as it ensures all necessary CocoaPods dependencies are included.

    Click File Icon in XCODE

  3. Adjust Xcode Settings: If the file icon is not already selected in the Project Navigator (usually on the left sidebar), then do so. Then, select YourProjectName in the file tab.

If you have NativeWind/Tailwind CSS, add this build script:

Steps for NativeWind/Tailwind CSS
  1. Configure Build Phases: Navigate to the Build Phases tab within your project settings. Click the + button on the panel and select New Run Script Phase.

  2. Create Node.js Symlink: Go back to your terminal and run the following command:

    sudo ln -s $(which node) /usr/local/bin/node
    

    This command creates a symbolic link, ensuring that Xcode can locate your Node.js installation, which is often a common issue when building React Native projects.

  3. Add Build Script: Paste the following script into the newly created Run Script Phase in Xcode:

    # Load nvm if it's not loaded
    export NVM_DIR="$HOME/.nvm"
    if [ -s "$NVM_DIR/nvm.sh" ]; then
      source "$NVM_DIR/nvm.sh"
    fi
    
    # Ensure Node is available
    export NODE_BINARY=/usr/local/bin/node
    echo "Node found at: $NODE_BINARY"
    
    "$NODE_BINARY" -v
    
    # Run NativeWind/Tailwind CSS build command
    "$NODE_BINARY" "$PROJECT_DIR/../node_modules/tailwindcss/lib/cli.js" -i "$PROJECT_DIR/../global.css" -o "$PROJECT_DIR/../node_modules/.cache/nativewind/global.css"
    
    # Continue with the React Native build script
    "$NODE_BINARY" --print "require('path').dirname(require.resolve('react-native/package.json')) + '/scripts/react-native-xcode.sh'"
    

    This script ensures that Node.js and necessary dependencies, such as NativeWind/Tailwind CSS, are correctly handled during the Xcode build process.


  1. Archive Your Application: Go to the top menu bar in Xcode, select Product > Archive, and wait for the build process to complete. If the build is successful, a menu should pop up.

  2. Locate Archive: Right-click on the newly created archive in the pop-up menu and select Show in Finder.

  3. Access Application Contents: Locate the .xcarchive file that was just created. Right-click on it and choose Show Package Contents. Then, navigate to Products > Applications.

  4. Create Payload Folder: Inside the Products > Applications directory, create a New Folder and name it Payload (ensuring it is case-sensitive).

  5. Move Application to Payload: Drag your YourProjectName.app (or your application's build output) into this newly created Payload folder.

  6. Compress Payload: Right-click on the Payload folder and select Compress 'Payload'. This will create a .zip file.

  7. Rename to IPA: Rename this .zip file to a .ipa file (e.g., Payload.ipa from Payload.zip).

Enjoy your newly built IPA!

← Back to Blog