diff --git a/agent-node/scripts/build_mac.sh b/agent-node/scripts/build_mac.sh new file mode 100644 index 0000000..d34f410 --- /dev/null +++ b/agent-node/scripts/build_mac.sh @@ -0,0 +1,42 @@ +#!/bin/bash +set -e + +# This script builds the standalone binary for macOS natively. +# It requires Python 3.10+ to be installed on your Mac. + +echo "๐Ÿ—๏ธ Setting up macOS native builder..." +cd "$(dirname "$0")/../.." + +echo "๐Ÿ”จ Creating ephemeral virtual environment..." +python3 -m venv .build-venv +source .build-venv/bin/activate + +echo "๐Ÿ“ฆ Installing requirements and PyInstaller..." +pip install --upgrade pip +pip install pyinstaller +pip install -r agent-node/requirements.txt + +echo "๐Ÿ”จ Building macOS Binary (darwin_arm64/amd64)..." +pyinstaller \ + --name cortex-agent \ + --onefile \ + --clean \ + --strip \ + --add-data "skills:skills" \ + --paths agent-node \ + agent-node/src/agent_node/main.py + +echo "โœ… Build complete! Moving binary to agent-node/dist/darwin_$(uname -m)/" +mkdir -p "agent-node/dist/darwin_$(uname -m)" +mv dist/cortex-agent "agent-node/dist/darwin_$(uname -m)/cortex-agent" +chmod +x "agent-node/dist/darwin_$(uname -m)/cortex-agent" + +echo "๐Ÿงน Cleaning up build artifacts..." +rm -rf build dist cortex-agent.spec +deactivate +rm -rf .build-venv + +echo "" +echo "๐Ÿ“ฑ Your native macOS binary is ready at: agent-node/dist/darwin_$(uname -m)/cortex-agent" +echo "If you want the production server to serve this binary, simply SCP it to your server:" +echo "scp -r agent-node/dist/darwin_$(uname -m) axieyangb@192.168.68.113:/home/coder/project/cortex-hub/agent-node/dist/"