neovide.neovide/macos-builder
Alexsander Falcucci 2d37b79e3f
ci: retry hdiutil during dmg creation (#3400)
macOS runners occasionally fails due to resource busy while create-dmg
is building the image.

```
Creating disk image...
hdiutil: create failed - Resource busy
Error: Process completed with exit code 1.
```
2026-03-12 19:53:06 +01:00
..
make-icns feat: add ability to open files from Finder in macOS (#2395) 2024-04-06 18:31:39 +03:00
readme.md feat: create apple code signing and notarization (#2814) 2024-11-06 02:39:14 +01:00
run ci: retry hdiutil during dmg creation (#3400) 2026-03-12 19:53:06 +01:00

Neovide Packaging for macOS

This script is designed to build (if needed) and package the Neovide application packaging it into a macOS .app bundle, and then creating a .dmg disk image for distribution.

Prerequisites

Before running the script, ensure you have the following dependencies installed:

Run the Script:

GENERATE_BUNDLE_APP=true GENERATE_DMG=true ./macos-builder/run aarch64-apple-darwin

Steps

Set Up Release Directory: The script sets the RELEASE_DIR based on the TARGET_ARCHITECTURE environment variable. If TARGET_ARCHITECTURE is not set, it defaults to target/release.

RELEASE_DIR=${TARGET_ARCHITECTURE:+target/${TARGET_ARCHITECTURE}/release}
RELEASE_DIR=${RELEASE_DIR:-target/release}

Build the Project: If the release directory does not exist, the script runs the cargo build --release command to build the project.

This is for local development purposes since you would typically build the project beforehand.

if [ ! -d "${RELEASE_DIR}" ]; then
  cargo build --release ${TARGET_ARCHITECTURE:+--target "${TARGET_ARCHITECTURE}"}
fi

Prepare the Application Bundle:

  • Sets up directories for the .app bundle.
  • Copies the built binary and other necessary resources into the bundle.
  • Signs the application using codesign.
mkdir -p "${APP_BINARY_DIR}"
mkdir -p "${APP_EXTRAS_DIR}"
cp -fRp "${APP_TEMPLATE}" "${APP_DIR}"
cp -fp "${APP_BINARY}" "${APP_BINARY_DIR}"
touch -r "${APP_BINARY}" "${APP_DIR}/${APP_NAME}"
codesign --remove-signature "${APP_DIR}/${APP_NAME}"
codesign --force --deep --sign - "${APP_DIR}/${APP_NAME}"

Create the Disk Image: Uses create-dmg to create a .dmg file for the application.

create-dmg \
  --filesystem "${DMG_FILESYSTEM}" \
  --format "${DMG_FORMAT}" \
  --volname "${DMG_VOLNAME}" \
  --volicon "${DMG_ICNS}" \
  --background "${DMG_BACKGROUND}" \
  --window-size 650 470 \
  --icon-size 80 \
  --icon Neovide.app 240 320 \
  --app-drop-link 410 320 \
  "${APP_DIR}/${DMG_NAME}" \
  "${APP_DIR}/${APP_NAME}"

Notes

  • Ensure all paths and filenames are correct and that the necessary files (like Neovide.icns and neovide-dmg-background.tiff) are present in their respective directories.
  • The script assumes a macOS environment with the necessary tools installed.