Skip to content

Instantly share code, notes, and snippets.

@onekung
Last active March 3, 2026 14:54
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

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