node-idevice: iOS App Management

0.1.6 · abandoned · verified Sun Apr 19

node-idevice is a Node.js wrapper for the `ideviceinstaller` command-line utility, designed to programmatically manage applications on iOS devices. It allows developers to install, remove, and list applications on a connected physical iOS device. The current stable version is `0.1.6`, published in 2017, indicating it is likely abandoned and no longer actively maintained. Its release cadence was irregular prior to cessation of development. A key differentiator is its ability to integrate iOS app management directly into Node.js workflows, such as CI/CD pipelines or automated testing setups, leveraging the robust `libimobiledevice` ecosystem. However, it relies heavily on the `ideviceinstaller` binary being pre-installed on the host system, typically via Homebrew, and exclusively uses a callback-based API, predating modern async/await patterns.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to install an IPA package on a connected iOS device, wait for the installation to complete, list all installed applications, and then remove the newly installed app. It highlights the callback-based API and the dependency on the `ideviceinstaller` binary.

const path = require('path');
const IDevice = require('node-idevice');

// --- Prerequisites ---
// 1. Install ideviceinstaller via Homebrew:
//    brew install ideviceinstaller
// 2. Connect an iOS device with developer mode enabled and 'Trust' the computer.
// 3. Replace 'your-app-bundle-id' and 'path/to/your/App.ipa' with actual values.

const ipaPath = path.resolve(__dirname, './path/to/your/App.ipa'); // Placeholder: replace with actual IPA path
const appBundleId = 'com.example.YourApp'; // Placeholder: replace with actual app bundle ID

const device = new IDevice(); // Uses ideviceinstaller from your $PATH

console.log(`Attempting to install ${appBundleId} from ${ipaPath} on connected iOS device...`);

device.installAndWait(ipaPath, appBundleId, function (err, success) {
  if (err) {
    console.error('Failed to install app:', err.message);
    if (err.message.includes('No device found')) {
        console.error('Please ensure an iOS device is connected, trusted, and has Developer Mode enabled.');
    } else if (err.message.includes('command not found')) {
        console.error('Please ensure ideviceinstaller is installed and in your system PATH (e.g., via `brew install ideviceinstaller`).');
    }
    return;
  }

  if (success) {
    console.log(`App ${appBundleId} installed successfully.`);
    // Optionally, list installed apps to verify
    device.listInstalled(function(listErr, data) {
        if (listErr) {
            console.error('Failed to list apps after install:', listErr.message);
            return;
        }
        console.log('Installed apps:', data.map(app => app.fullname));
        // Remove the app for cleanup or further testing
        device.remove(appBundleId, function(removeErr) {
            if (removeErr) {
                console.error(`Failed to remove ${appBundleId}:`, removeErr.message);
                return;
            }
            console.log(`App ${appBundleId} removed successfully.`);
        });
    });
  } else {
    console.log(`App ${appBundleId} installation reported no success, but no error.`);
  }
});

view raw JSON →