Skip to content

Instantly share code, notes, and snippets.

@onekung
Last active March 12, 2026 20:36
Show Gist options
  • Select an option

  • Save onekung/b0d5d644033099c48f404d3b694c1876 to your computer and use it in GitHub Desktop.

Select an option

Save onekung/b0d5d644033099c48f404d3b694c1876 to your computer and use it in GitHub Desktop.
Fix google Antigravity (Remote SSH on macOS: Fixing "posix_spawnp failed" and 404 Download Errors)
## Troubleshooting Antigravity Remote SSH on macOS: Fixing "posix_spawnp failed" and 404 Download Errors
When attempting to use **Antigravity** (or similar IDEs) to connect via Remote-SSH to a macOS (Darwin) server, you might encounter a `posix_spawnp failed` error or a `404 Not Found` during the server installation phase. This usually happens because the official `darwin-arm` server binary is missing from the download mirrors.
Below is a verified workaround to manually "assemble" a working Remote Server by bridging the Linux-arm structure with native Darwin binaries.
### 🛠 Prerequisites
On your **Remote macOS Server**, ensure you have the necessary tools installed via Homebrew:
```bash
brew install wget flock
```
edit or add ~/.bashrc or ~/.zshrc and ~/.zshenv
export PATH="/opt/homebrew/bin:$PATH" >> ~/.zshrc
export PATH="/opt/homebrew/bin:/usr/local/bin:$PATH"
---
### Step 1: Identify the COMMIT_ID and Prepare Host Files
1. Open Antigravity on your **Host machine** and attempt to connect to the Remote SSH.
2. Check the **Output tab (Antigravity Server)**. Look for the failed download URL to extract the **COMMIT_ID**:
*Example:* `.../stable/d2597a5c475647ed306b22de1e39853c7812d07d/darwin-arm/...`
3. Set your environment variable and create a staging folder on your **Host**:
```bash
export COMMIT_ID="1.19.6-d2597a5c475647ed306b22de1e39853c7812d07d"
mkdir -p ~/.antigravity-copy/bin/$COMMIT_ID
```
4. Copy the native Darwin files from your local App bundle to the staging folder:
```bash
cp -R /Applications/Antigravity.app/Contents/Resources/app/* ~/.antigravity-copy/bin/$COMMIT_ID/
```
---
### Step 2: Initialize the "Skeleton" on the Remote Server
Since the `darwin-arm` tarball is missing, we will use the `linux-arm` version as a structural base.
1. Log in to your **Remote macOS Server**.
2. Download and extract the `linux-arm` server (replace the URL with the one from your logs, changing `darwin-arm` to `linux-arm`):
```bash
wget https://edgedl.me.gvt1.com/.../linux-arm/Antigravity-reh.tar.gz
export COMMIT_ID="1.19.6-d2597a5c475647ed306b22de1e39853c7812d07d"
mkdir -p ~/.antigravity-server/bin/$COMMIT_ID
tar -xzf Antigravity-reh.tar.gz -C ~/.antigravity-server/bin/$COMMIT_ID --strip-components 1
```
---
### Step 3: Rebuild Native Modules for macOS
Now we need to replace the Linux-specific libraries with macOS-compatible ones.
1. Navigate to the server directory on the **Remote machine**:
```bash
cd ~/.antigravity-server/bin/$COMMIT_ID
```
2. Reinstall the core dependencies to trigger a native build for Darwin:
```bash
npm install @microsoft/1ds-core-js @microsoft/1ds-post-js @parcel/watcher @vscode/deviceid @vscode/proxy-agent @vscode/ripgrep @vscode/spdlog @xterm/addon-serialize @xterm/addon-unicode11 @xterm/headless @xterm/xterm cookie native-watchdog node-pty vscode-regexpp
```
---
### Step 4: Swapping the Node Binary
The `node` binary included in the Linux tarball will not execute on macOS. You must replace it with a compatible Darwin Node binary.
1. You can borrow a compatible binary from other IDE servers like Cursor or VS Code:
```bash
# Example: Copying from Cursor server
cp /Users/youruser/.cursor-server/cli/servers/node ~/.antigravity-server/bin/$COMMIT_ID/node
```
---
### Step 5: Synchronize Host-Specific Files
To ensure the IDE features and terminal work correctly, sync the `extensions` and the native `node-pty` module from your **Host** to the **Remote Server**:
1. Transfer the `extensions` directory from `~/.antigravity-copy/` on the Host to the corresponding path on the Remote.
2. **Crucial:** Overwrite the `node_modules/node-pty` folder on the Remote with the one from the Host. This is the primary fix for the `posix_spawnp` error.
---
### Step 6: Security and Cleanup
1. (Optional) Remove problematic extensions that might cause CommonJS load warnings:
```bash
rm -rf ~/.antigravity-server/bin/$COMMIT_ID/extensions/chrome-devtools-mcp
```
2. Clear the macOS **Quarantine** attribute to allow the binaries to run:
```bash
xattr -d com.apple.quarantine ~/.antigravity-server/bin/$COMMIT_ID
```
---
### Conclusion
After following these steps, reconnect your IDE via SSH. The server should now initialize correctly, and the integrated terminal will be fully functional. This hybrid approach bypasses the 404 mirror issue by manually providing the Darwin-specific logic required by macOS.
*Note: This is a community workaround. Always back up your configurations before making manual changes to server binaries.*
---
@gth-ai
Copy link

gth-ai commented Feb 27, 2026

Fix: posix_spawnp failed After Completing the Hybrid Setup

If you followed the guide above and successfully connect via Remote SSH but get this error when opening a terminal:

The terminal process failed to launch: A native exception occurred during launch (posix_spawnp failed.)

The issue is that macOS requires ad-hoc code signing on the native binaries (node, pty.node, and spawn-helper) before they can be executed. This is a Gatekeeper enforcement that applies even to unsigned binaries copied from other sources (e.g., Cursor Server).


Fix (on the Remote macOS Server)

export COMMIT_ID="<your-version-commit-id>"
# e.g. export COMMIT_ID="1.19.6-d2597a5c475647ed306b22de1e39853c78122222"
cd ~/.antigravity-server/bin/$COMMIT_ID

1. Sign the Node binary:

codesign --force --deep --sign - node

2. Sign all .node native modules:

find node_modules/node-pty -name "*.node" -exec codesign --force --sign - {} \;

3. Sign and set permissions on spawn-helper binaries:

codesign --force --sign - node_modules/node-pty/prebuilds/darwin-arm64/spawn-helper
chmod +x node_modules/node-pty/prebuilds/darwin-arm64/spawn-helper

4. Clear quarantine flags (in case they were re-applied):

xattr -dr com.apple.quarantine ~/.antigravity-server/bin/$COMMIT_ID

5. Reconnect via Remote SSH and open a new terminal.


Quick Verification

Before reconnecting, you can verify the binaries are correct:

file node_modules/node-pty/prebuilds/darwin-arm64/pty.node
# Expected: Mach-O 64-bit bundle arm64

file node_modules/node-pty/prebuilds/darwin-arm64/spawn-helper
# Expected: Mach-O 64-bit executable arm64

file node
# Expected: Mach-O 64-bit executable arm64

If any of these return ELF or Linux, the binary was not properly replaced during the hybrid setup — go back to Steps 3–5 of the original guide.


Why This Happens

macOS Gatekeeper blocks execution of unsigned binaries, even in non-GUI contexts like SSH sessions. The posix_spawnp error is the system-level rejection of an unsigned or quarantined executable. Since we're assembling the server from multiple sources (linux-arm skeleton, Cursor's Node binary, npm-rebuilt modules), none of these binaries carry a valid signature for the current context.

The ad-hoc signing (--sign -) tells macOS to trust these binaries locally without requiring a Developer ID certificate.


Tested on: Mac Studio M4 Max (macOS Sequoia) as remote, MacBook Pro as host, Antigravity v1.19.6, connected via Tailscale.

@gth-ai

@o3o3o
Copy link

o3o3o commented Mar 10, 2026

Fixing Antigravity Remote SSH on macOS (Darwin/arm64)

Problem Summary

When using Antigravity to connect via Remote-SSH to a macOS server, you may encounter:

  • posix_spawnp failed - Terminal cannot launch
  • 404 errors - darwin-arm server binary not found
  • Extension host terminates unexpectedly

Root Cause: Official builds do not provide darwin-arm server packages.


Complete Fix Guide

Step 1: Extract COMMIT_ID

Get the version info from error logs:
COMMIT_ID="1.19.6-d2597a5c475647ed306b22de1e39853c7812d07d"

Step 2: Initialize linux-arm Skeleton on Remote Server

SSH to remote macOS server

ssh user@your-server

Set variables

export COMMIT_ID="1.19.6-d2597a5c475647ed306b22de1e39853c7812d07d"
mkdir -p ~/.antigravity-server/bin/$COMMIT_ID
cd ~/.antigravity-server/bin/$COMMIT_ID

Download linux-arm version as structural base

wget https://edgedl.me.gvt1.com/edgedl/release2/j0qc3/antigravity/stable/$COMMIT_ID/linux-arm/Antigravity-reh.tar.gz
tar -xzf Antigravity-reh.tar.gz --strip-components 1
rm Antigravity-reh.tar.gz

Step 3: Rebuild Native Modules for macOS

cd ~/.antigravity-server/bin/$COMMIT_ID

Install and rebuild all native dependencies

npm install @microsoft/1ds-core-js @microsoft/1ds-post-js
npm install @parcel/watcher @vscode/deviceid @vscode/proxy-agent
npm install @vscode/ripgrep @vscode/spdlog
npm install @xterm/addon-serialize @xterm/addon-unicode11 @xterm/headless @xterm/xterm
npm install cookie native-watchdog node-pty vscode-regexpp
npm install yauzl

Step 4: Replace with Static Node.js Build

cd /tmp
curl -fsSL https://nodejs.org/dist/v22.11.0/node-v22.11.0-darwin-arm64.tar.gz -o node.tar.gz
tar -xzf node.tar.gz
cp node-v22.11.0-darwin-arm64/bin/node ~/.antigravity-server/bin/$COMMIT_ID/node
rm -rf node-v22.11.0-darwin-arm64 node.tar.gz

Step 5: Copy Extensions from Local Antigravity.app

Execute on remote server

export COMMIT_ID="1.19.6-d2597a5c475647ed306b22de1e39853c7812d07d"
cp -R /Applications/Antigravity.app/Contents/Resources/app/extensions/*
~/.antigravity-server/bin/$COMMIT_ID/extensions/

Step 6: Code Signing (Critical Step)

cd ~/.antigravity-server/bin/$COMMIT_ID

Clear quarantine flags

xattr -dr com.apple.quarantine .

Sign node binary

codesign --force --deep --sign - node

Sign all .node native modules

find node_modules -name "*.node" -exec codesign --force --sign - {} ;

Sign and set spawn-helper permissions

chmod +x node_modules/node-pty/prebuilds/darwin-arm64/spawn-helper
codesign --force --sign - node_modules/node-pty/prebuilds/darwin-arm64/spawn-helper

Step 7: Modify Startup Script for Library Path

Edit ~/.antigravity-server/bin/$COMMIT_ID/bin/antigravity-server, add before node command:

export DYLD_LIBRARY_PATH="/opt/homebrew/lib:$DYLD_LIBRARY_PATH"

Full script example:

#!/usr/bin/env sh
case "$1" in
--inspect*) INSPECT="$1"; shift;;
esac

ROOT="$(dirname "$(dirname "$(readlink -f "$0")")")"

Add Homebrew library path

export DYLD_LIBRARY_PATH="/opt/homebrew/lib:$DYLD_LIBRARY_PATH"

"$ROOT/node" ${INSPECT:-} "$ROOT/out/server-main.js" "$@"

Step 8: Final Rebuild and Verification

cd ~/.antigravity-server/bin/$COMMIT_ID

Final rebuild of all modules

npm rebuild @microsoft/1ds-core-js @microsoft/1ds-post-js @parcel/watcher
@vscode/deviceid @vscode/proxy-agent @vscode/ripgrep @vscode/spdlog
@xterm/addon-serialize @xterm/addon-unicode11 @xterm/headless @xterm/xterm
cookie native-watchdog node-pty vscode-regexpp

Verify binary formats

file node_modules/node-pty/prebuilds/darwin-arm64/pty.node
file node_modules/node-pty/prebuilds/darwin-arm64/spawn-helper
file node

All should show: Mach-O 64-bit executable/bundle arm64


Troubleshooting Common Issues

Issue 1: posix_spawnp failed

Solution: Ensure all .node files and spawn-helper are code signed

Issue 2: Extension Host terminated (SIGKILL)

Solution:

  • Use static Node.js build (not Homebrew's)
  • Rebuild all native modules

Issue 3: Unknown reconnection token

Solution:

  • Kill all remote server processes: pkill -9 -f antigravity-server
  • Fully quit and reopen local Antigravity

Issue 4: Cannot find package 'yauzl'

Solution: npm install yauzl


Cleanup Commands

To completely reset:

On remote server

pkill -9 -f antigravity-server
rm -rf ~/.antigravity-server
rm -f ~/.antigravity-server/.*.token

On local: Fully quit Antigravity and reopen


System Requirements

  • Remote Server: macOS (Darwin) arm64
  • Local Machine: Antigravity Desktop
  • Required Tools: Homebrew, wget, npm, codesign

AI Agent Prompt Template

I need to fix Antigravity Remote SSH installation on a macOS server.

Error logs: [paste error logs here]

Server Information:

  • System: macOS (Darwin) arm64
  • COMMIT_ID: [extract from logs]
  • Installed: Homebrew, npm, wget

Please follow the hybrid setup approach:

  1. Use linux-arm package as skeleton base
  2. Replace with static Node.js build
  3. Code sign all native modules
  4. Rebuild all native dependencies for darwin-arm64

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment