Skip to content

Self-improving AI Employees for everyone

Add one-line install scripts for Linux/macOS/Windows

trohitg6fe678591dd4
diff --git a/README.md b/README.md
index 2474ca83..9ef9f78e 100644
--- a/README.md
+++ b/README.md
@@ -4,7 +4,21 @@ Open-source workflow automation platform with AI agents, React Flow, and n8n-ins
## Quick Start
-### Option 1: Clone & Run
+### Option 1: One-Line Install (Recommended)
+
+**Linux/macOS:**
+```bash
+curl -fsSL https://raw.githubusercontent.com/trohitg/MachinaOS/main/install.sh | bash
+```
+
+**Windows (PowerShell):**
+```powershell
+iwr -useb https://raw.githubusercontent.com/trohitg/MachinaOS/main/install.ps1 | iex
+```
+
+This automatically installs all dependencies (Node.js, Python, uv, Go) and MachinaOS.
+
+### Option 2: Clone & Run
```bash
git clone https://github.com/trohitg/MachinaOS.git
@@ -13,14 +27,16 @@ npm run build
npm run start
```
-### Option 2: Global Install
+### Option 3: npm Global Install
```bash
npm install -g machinaos
machinaos start
```
-### Option 3: Docker
+Requires Node.js 18+, Python 3.11+, uv, and Go 1.21+ to be pre-installed.
+
+### Option 4: Docker
```bash
git clone https://github.com/trohitg/MachinaOS.git
@@ -32,6 +48,8 @@ Open http://localhost:3000
## Prerequisites
+The install script handles these automatically, but for manual installation:
+
- **Node.js 18+** - https://nodejs.org/
- **Python 3.11+** - https://python.org/
- **uv** - `curl -LsSf https://astral.sh/uv/install.sh | sh`
diff --git a/install.ps1 b/install.ps1
new file mode 100644
index 00000000..62ec9a8e
--- /dev/null
+++ b/install.ps1
@@ -0,0 +1,308 @@
+# MachinaOS Installer for Windows
+# Usage: iwr -useb https://raw.githubusercontent.com/trohitg/MachinaOS/main/install.ps1 | iex
+#
+# This script installs MachinaOS and its dependencies:
+# - Node.js 18+ (via winget/choco)
+# - Python 3.11+ (via winget/choco)
+# - uv (Python package manager)
+# - Go 1.21+ (for WhatsApp service)
+
+$ErrorActionPreference = "Stop"
+
+# Configuration
+$REPO_URL = "https://github.com/trohitg/MachinaOS.git"
+$INSTALL_DIR = if ($env:MACHINAOS_HOME) { $env:MACHINAOS_HOME } else { "$env:USERPROFILE\.machinaos" }
+$MIN_NODE_VERSION = 18
+$MIN_PYTHON_VERSION = "3.11"
+$MIN_GO_VERSION = "1.21"
+
+# Colors
+function Write-Color {
+ param([string]$Text, [string]$Color = "White")
+ Write-Host $Text -ForegroundColor $Color
+}
+
+function Info { Write-Color "[INFO] $args" "Cyan" }
+function Success { Write-Color "[OK] $args" "Green" }
+function Warn { Write-Color "[WARN] $args" "Yellow" }
+function Error-Exit { Write-Color "[ERROR] $args" "Red"; exit 1 }
+
+# Banner
+Write-Host ""
+Write-Color " __ __ _ _ ___ ____ " "Cyan"
+Write-Color " | \/ | __ _ ___| |__ (_)_ __ __ _/ _ \/ ___| " "Cyan"
+Write-Color " | |\/| |/ _`` |/ __| '_ \| | '_ \ / _`` | | | \___ \ " "Cyan"
+Write-Color " | | | | (_| | (__| | | | | | | | (_| | |_| |___) |" "Cyan"
+Write-Color " |_| |_|\__,_|\___|_| |_|_|_| |_|\__,_|\___/|____/ " "Cyan"
+Write-Host ""
+Write-Host "Open-source workflow automation with AI agents"
+Write-Host ""
+
+# Check if command exists
+function Has-Command {
+ param([string]$Command)
+ $null -ne (Get-Command $Command -ErrorAction SilentlyContinue)
+}
+
+# Get package manager
+function Get-PackageManager {
+ if (Has-Command "winget") { return "winget" }
+ if (Has-Command "choco") { return "choco" }
+ return $null
+}
+
+# =============================================================================
+# Dependency Checks and Installation
+# =============================================================================
+
+function Check-Node {
+ if (Has-Command "node") {
+ $version = (node --version) -replace "v", ""
+ $major = [int]($version.Split(".")[0])
+ if ($major -ge $MIN_NODE_VERSION) {
+ Success "Node.js v$version"
+ return $true
+ }
+ Warn "Node.js v$version is too old (need v$MIN_NODE_VERSION+)"
+ }
+ return $false
+}
+
+function Install-Node {
+ Info "Installing Node.js..."
+ $pm = Get-PackageManager
+
+ switch ($pm) {
+ "winget" {
+ winget install OpenJS.NodeJS.LTS --accept-package-agreements --accept-source-agreements
+ }
+ "choco" {
+ choco install nodejs-lts -y
+ }
+ default {
+ Error-Exit "Please install winget or chocolatey, or install Node.js manually from https://nodejs.org/"
+ }
+ }
+
+ # Refresh PATH
+ $env:Path = [System.Environment]::GetEnvironmentVariable("Path", "Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path", "User")
+
+ if (-not (Check-Node)) {
+ Error-Exit "Failed to install Node.js. Please install manually and restart PowerShell."
+ }
+}
+
+function Check-Python {
+ foreach ($cmd in @("python", "python3")) {
+ if (Has-Command $cmd) {
+ $version = & $cmd --version 2>&1 | Select-String -Pattern "\d+\.\d+" | ForEach-Object { $_.Matches.Value }
+ if ($version -ge $MIN_PYTHON_VERSION) {
+ Success "Python $version ($cmd)"
+ $script:PYTHON_CMD = $cmd
+ return $true
+ }
+ }
+ }
+ Warn "Python $MIN_PYTHON_VERSION+ not found"
+ return $false
+}
+
+function Install-Python {
+ Info "Installing Python..."
+ $pm = Get-PackageManager
+
+ switch ($pm) {
+ "winget" {
+ winget install Python.Python.3.12 --accept-package-agreements --accept-source-agreements
+ }
+ "choco" {
+ choco install python312 -y
+ }
+ default {
+ Error-Exit "Please install winget or chocolatey, or install Python manually from https://python.org/"
+ }
+ }
+
+ # Refresh PATH
+ $env:Path = [System.Environment]::GetEnvironmentVariable("Path", "Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path", "User")
+
+ if (-not (Check-Python)) {
+ Error-Exit "Failed to install Python. Please install manually and restart PowerShell."
+ }
+}
+
+function Check-Uv {
+ if (Has-Command "uv") {
+ $version = (uv --version) -replace "uv ", ""
+ Success "uv $version"
+ return $true
+ }
+ return $false
+}
+
+function Install-Uv {
+ Info "Installing uv (Python package manager)..."
+ Invoke-RestMethod https://astral.sh/uv/install.ps1 | Invoke-Expression
+
+ # Add to PATH for current session
+ $env:Path = "$env:USERPROFILE\.local\bin;$env:Path"
+
+ if (-not (Check-Uv)) {
+ Error-Exit "Failed to install uv"
+ }
+}
+
+function Check-Go {
+ if (Has-Command "go") {
+ $versionOutput = go version
+ if ($versionOutput -match "go(\d+\.\d+)") {
+ $version = $Matches[1]
+ if ($version -ge $MIN_GO_VERSION) {
+ Success "Go $version"
+ return $true
+ }
+ Warn "Go $version is too old (need $MIN_GO_VERSION+)"
+ }
+ }
+ return $false
+}
+
+function Install-Go {
+ Info "Installing Go..."
+ $pm = Get-PackageManager
+
+ switch ($pm) {
+ "winget" {
+ winget install GoLang.Go --accept-package-agreements --accept-source-agreements
+ }
+ "choco" {
+ choco install golang -y
+ }
+ default {
+ Error-Exit "Please install winget or chocolatey, or install Go manually from https://go.dev/dl/"
+ }
+ }
+
+ # Refresh PATH
+ $env:Path = [System.Environment]::GetEnvironmentVariable("Path", "Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path", "User")
+
+ if (-not (Check-Go)) {
+ Error-Exit "Failed to install Go. Please install manually and restart PowerShell."
+ }
+}
+
+function Check-Git {
+ if (Has-Command "git") {
+ $version = (git --version) -replace "git version ", ""
+ Success "Git $version"
+ return $true
+ }
+ return $false
+}
+
+function Install-Git {
+ Info "Installing Git..."
+ $pm = Get-PackageManager
+
+ switch ($pm) {
+ "winget" {
+ winget install Git.Git --accept-package-agreements --accept-source-agreements
+ }
+ "choco" {
+ choco install git -y
+ }
+ default {
+ Error-Exit "Please install winget or chocolatey, or install Git manually from https://git-scm.com/"
+ }
+ }
+
+ # Refresh PATH
+ $env:Path = [System.Environment]::GetEnvironmentVariable("Path", "Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path", "User")
+
+ if (-not (Check-Git)) {
+ Error-Exit "Failed to install Git. Please install manually and restart PowerShell."
+ }
+}
+
+# =============================================================================
+# MachinaOS Installation
+# =============================================================================
+
+function Install-MachinaOS {
+ Write-Host ""
+ Info "Installing MachinaOS to $INSTALL_DIR..."
+
+ # Create install directory
+ if (-not (Test-Path $INSTALL_DIR)) {
+ New-Item -ItemType Directory -Path $INSTALL_DIR -Force | Out-Null
+ }
+
+ # Clone or update repository
+ if (Test-Path "$INSTALL_DIR\.git") {
+ Info "Updating existing installation..."
+ Push-Location $INSTALL_DIR
+ git pull origin main
+ } else {
+ Info "Cloning repository..."
+ git clone $REPO_URL $INSTALL_DIR
+ Push-Location $INSTALL_DIR
+ }
+
+ # Run build
+ Info "Building MachinaOS..."
+ npm run build
+
+ Pop-Location
+
+ # Add to PATH suggestion
+ $binPath = "$INSTALL_DIR\bin"
+ if ($env:Path -notlike "*$binPath*") {
+ Warn "Add MachinaOS to your PATH:"
+ Write-Host ""
+ Write-Host " # Run this command to add to PATH permanently:"
+ Write-Host " [Environment]::SetEnvironmentVariable('Path', `$env:Path + ';$binPath', 'User')"
+ Write-Host ""
+ }
+}
+
+# =============================================================================
+# Main Installation Flow
+# =============================================================================
+
+function Main {
+ Write-Host ""
+ Info "Checking dependencies..."
+ Write-Host ""
+
+ # Check and install dependencies
+ if (-not (Check-Git)) { Install-Git }
+ if (-not (Check-Node)) { Install-Node }
+ if (-not (Check-Python)) { Install-Python }
+ if (-not (Check-Uv)) { Install-Uv }
+ if (-not (Check-Go)) { Install-Go }
+
+ # Install MachinaOS
+ Install-MachinaOS
+
+ Write-Host ""
+ Write-Color "============================================" "Green"
+ Write-Color " MachinaOS installed successfully!" "Green"
+ Write-Color "============================================" "Green"
+ Write-Host ""
+ Write-Host " Start MachinaOS:"
+ Write-Host " cd $INSTALL_DIR"
+ Write-Host " npm run start"
+ Write-Host ""
+ Write-Host " Or use the CLI:"
+ Write-Host " node $INSTALL_DIR\bin\cli.js start"
+ Write-Host ""
+ Write-Host " Open in browser:"
+ Write-Host " http://localhost:3000"
+ Write-Host ""
+ Write-Host " Documentation:"
+ Write-Host " https://github.com/trohitg/MachinaOS"
+ Write-Host ""
+}
+
+# Run main
+Main
diff --git a/install.sh b/install.sh
new file mode 100644
index 00000000..88cc292b
--- /dev/null
+++ b/install.sh
@@ -0,0 +1,343 @@
+#!/usr/bin/env bash
+# MachinaOS Installer
+# Usage: curl -fsSL https://raw.githubusercontent.com/trohitg/MachinaOS/main/install.sh | bash
+#
+# This script installs MachinaOS and its dependencies:
+# - Node.js 18+ (if not installed)
+# - Python 3.11+ (if not installed)
+# - uv (Python package manager)
+# - Go 1.21+ (for WhatsApp service)
+
+set -e
+
+# Colors
+RED='\033[0;31m'
+GREEN='\033[0;32m'
+YELLOW='\033[1;33m'
+BLUE='\033[0;34m'
+CYAN='\033[0;36m'
+NC='\033[0m' # No Color
+
+# Configuration
+REPO_URL="https://github.com/trohitg/MachinaOS.git"
+INSTALL_DIR="${MACHINAOS_HOME:-$HOME/.machinaos}"
+MIN_NODE_VERSION=18
+MIN_PYTHON_VERSION="3.11"
+MIN_GO_VERSION="1.21"
+
+# Logging functions
+info() { echo -e "${BLUE}[INFO]${NC} $1"; }
+success() { echo -e "${GREEN}[OK]${NC} $1"; }
+warn() { echo -e "${YELLOW}[WARN]${NC} $1"; }
+error() { echo -e "${RED}[ERROR]${NC} $1"; exit 1; }
+
+# Banner
+echo -e "${CYAN}"
+echo " __ __ _ _ ___ ____ "
+echo " | \/ | __ _ ___| |__ (_)_ __ __ _/ _ \/ ___| "
+echo " | |\/| |/ _\` |/ __| '_ \| | '_ \ / _\` | | | \___ \\ "
+echo " | | | | (_| | (__| | | | | | | | (_| | |_| |___) |"
+echo " |_| |_|\__,_|\___|_| |_|_|_| |_|\__,_|\___/|____/ "
+echo -e "${NC}"
+echo "Open-source workflow automation with AI agents"
+echo ""
+
+# Detect OS
+detect_os() {
+ case "$(uname -s)" in
+ Linux*) OS="linux";;
+ Darwin*) OS="macos";;
+ MINGW*|MSYS*|CYGWIN*) OS="windows";;
+ *) error "Unsupported operating system: $(uname -s)";;
+ esac
+
+ # Detect architecture
+ case "$(uname -m)" in
+ x86_64|amd64) ARCH="x64";;
+ arm64|aarch64) ARCH="arm64";;
+ *) error "Unsupported architecture: $(uname -m)";;
+ esac
+
+ info "Detected: $OS ($ARCH)"
+}
+
+# Check if command exists
+has_cmd() {
+ command -v "$1" &> /dev/null
+}
+
+# Get version number from string
+get_version() {
+ echo "$1" | grep -oE '[0-9]+\.[0-9]+' | head -1
+}
+
+# Compare versions (returns 0 if $1 >= $2)
+version_gte() {
+ [ "$(printf '%s\n' "$2" "$1" | sort -V | head -n1)" = "$2" ]
+}
+
+# =============================================================================
+# Dependency Checks and Installation
+# =============================================================================
+
+check_node() {
+ if has_cmd node; then
+ NODE_VERSION=$(node --version | sed 's/v//')
+ NODE_MAJOR=$(echo "$NODE_VERSION" | cut -d. -f1)
+ if [ "$NODE_MAJOR" -ge "$MIN_NODE_VERSION" ]; then
+ success "Node.js v$NODE_VERSION"
+ return 0
+ else
+ warn "Node.js v$NODE_VERSION is too old (need v$MIN_NODE_VERSION+)"
+ fi
+ fi
+ return 1
+}
+
+install_node() {
+ info "Installing Node.js..."
+
+ if [ "$OS" = "macos" ]; then
+ if has_cmd brew; then
+ brew install node@20
+ else
+ error "Please install Homebrew first: https://brew.sh/"
+ fi
+ elif [ "$OS" = "linux" ]; then
+ # Use NodeSource for latest Node.js
+ if has_cmd curl; then
+ curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -
+ sudo apt-get install -y nodejs
+ else
+ error "curl is required. Install with: sudo apt install curl"
+ fi
+ fi
+
+ check_node || error "Failed to install Node.js"
+}
+
+check_python() {
+ local py_cmd=""
+
+ # Try python3 first, then python
+ for cmd in python3 python; do
+ if has_cmd "$cmd"; then
+ PY_VERSION=$($cmd --version 2>&1 | grep -oE '[0-9]+\.[0-9]+')
+ if version_gte "$PY_VERSION" "$MIN_PYTHON_VERSION"; then
+ success "Python $PY_VERSION ($cmd)"
+ PYTHON_CMD="$cmd"
+ return 0
+ fi
+ fi
+ done
+
+ warn "Python $MIN_PYTHON_VERSION+ not found"
+ return 1
+}
+
+install_python() {
+ info "Installing Python..."
+
+ if [ "$OS" = "macos" ]; then
+ if has_cmd brew; then
+ brew install [email protected]
+ else
+ error "Please install Homebrew first: https://brew.sh/"
+ fi
+ elif [ "$OS" = "linux" ]; then
+ if has_cmd apt; then
+ sudo apt update
+ sudo apt install -y python3.12 python3.12-venv python3-pip
+ elif has_cmd dnf; then
+ sudo dnf install -y python3.12
+ elif has_cmd pacman; then
+ sudo pacman -S --noconfirm python
+ else
+ error "Please install Python manually from https://python.org/"
+ fi
+ fi
+
+ check_python || error "Failed to install Python"
+}
+
+check_uv() {
+ if has_cmd uv; then
+ UV_VERSION=$(uv --version | grep -oE '[0-9]+\.[0-9]+\.[0-9]+')
+ success "uv $UV_VERSION"
+ return 0
+ fi
+ return 1
+}
+
+install_uv() {
+ info "Installing uv (Python package manager)..."
+ curl -LsSf https://astral.sh/uv/install.sh | sh
+
+ # Add to PATH for current session
+ export PATH="$HOME/.local/bin:$PATH"
+
+ check_uv || error "Failed to install uv"
+}
+
+check_go() {
+ if has_cmd go; then
+ GO_VERSION=$(go version | grep -oE 'go[0-9]+\.[0-9]+' | sed 's/go//')
+ if version_gte "$GO_VERSION" "$MIN_GO_VERSION"; then
+ success "Go $GO_VERSION"
+ return 0
+ else
+ warn "Go $GO_VERSION is too old (need $MIN_GO_VERSION+)"
+ fi
+ fi
+ return 1
+}
+
+install_go() {
+ info "Installing Go..."
+
+ if [ "$OS" = "macos" ]; then
+ if has_cmd brew; then
+ brew install go
+ else
+ error "Please install Homebrew first: https://brew.sh/"
+ fi
+ elif [ "$OS" = "linux" ]; then
+ if has_cmd apt; then
+ sudo apt update
+ sudo apt install -y golang-go
+ elif has_cmd dnf; then
+ sudo dnf install -y golang
+ elif has_cmd pacman; then
+ sudo pacman -S --noconfirm go
+ else
+ # Manual install
+ GO_TAR="go1.21.13.linux-${ARCH}.tar.gz"
+ curl -LO "https://go.dev/dl/$GO_TAR"
+ sudo rm -rf /usr/local/go
+ sudo tar -C /usr/local -xzf "$GO_TAR"
+ rm "$GO_TAR"
+ export PATH="$PATH:/usr/local/go/bin"
+ fi
+ fi
+
+ check_go || error "Failed to install Go"
+}
+
+check_git() {
+ if has_cmd git; then
+ GIT_VERSION=$(git --version | grep -oE '[0-9]+\.[0-9]+')
+ success "Git $GIT_VERSION"
+ return 0
+ fi
+ return 1
+}
+
+install_git() {
+ info "Installing Git..."
+
+ if [ "$OS" = "macos" ]; then
+ xcode-select --install 2>/dev/null || true
+ elif [ "$OS" = "linux" ]; then
+ if has_cmd apt; then
+ sudo apt update && sudo apt install -y git
+ elif has_cmd dnf; then
+ sudo dnf install -y git
+ elif has_cmd pacman; then
+ sudo pacman -S --noconfirm git
+ fi
+ fi
+
+ check_git || error "Failed to install Git"
+}
+
+# =============================================================================
+# MachinaOS Installation
+# =============================================================================
+
+install_machinaos() {
+ echo ""
+ info "Installing MachinaOS to $INSTALL_DIR..."
+
+ # Create install directory
+ mkdir -p "$INSTALL_DIR"
+
+ # Clone or update repository
+ if [ -d "$INSTALL_DIR/.git" ]; then
+ info "Updating existing installation..."
+ cd "$INSTALL_DIR"
+ git pull origin main
+ else
+ info "Cloning repository..."
+ git clone "$REPO_URL" "$INSTALL_DIR"
+ cd "$INSTALL_DIR"
+ fi
+
+ # Run build
+ info "Building MachinaOS..."
+ npm run build
+
+ # Create symlink for global command
+ info "Creating global command..."
+
+ SYMLINK_DIR="$HOME/.local/bin"
+ mkdir -p "$SYMLINK_DIR"
+
+ # Remove old symlink if exists
+ rm -f "$SYMLINK_DIR/machinaos"
+
+ # Create new symlink
+ ln -s "$INSTALL_DIR/bin/cli.js" "$SYMLINK_DIR/machinaos"
+ chmod +x "$INSTALL_DIR/bin/cli.js"
+
+ # Check if PATH includes ~/.local/bin
+ if [[ ":$PATH:" != *":$SYMLINK_DIR:"* ]]; then
+ warn "Add $SYMLINK_DIR to your PATH:"
+ echo ""
+ echo " # Add to ~/.bashrc or ~/.zshrc:"
+ echo " export PATH=\"\$HOME/.local/bin:\$PATH\""
+ echo ""
+ fi
+}
+
+# =============================================================================
+# Main Installation Flow
+# =============================================================================
+
+main() {
+ detect_os
+
+ echo ""
+ info "Checking dependencies..."
+ echo ""
+
+ # Check and install dependencies
+ check_git || install_git
+ check_node || install_node
+ check_python || install_python
+ check_uv || install_uv
+ check_go || install_go
+
+ # Install MachinaOS
+ install_machinaos
+
+ echo ""
+ echo -e "${GREEN}============================================${NC}"
+ echo -e "${GREEN} MachinaOS installed successfully!${NC}"
+ echo -e "${GREEN}============================================${NC}"
+ echo ""
+ echo " Start MachinaOS:"
+ echo " cd $INSTALL_DIR && npm run start"
+ echo ""
+ echo " Or use the global command (after adding to PATH):"
+ echo " machinaos start"
+ echo ""
+ echo " Open in browser:"
+ echo " http://localhost:3000"
+ echo ""
+ echo " Documentation:"
+ echo " https://github.com/trohitg/MachinaOS"
+ echo ""
+}
+
+# Run main
+main "$@"
diff --git a/package.json b/package.json
index a024f5b6..1db7bd7f 100644
--- a/package.json
+++ b/package.json
@@ -38,7 +38,9 @@
"client/",
"server/",
".env.template",
- "README.md"
+ "README.md",
+ "install.sh",
+ "install.ps1"
],
"workspaces": [
"client"
diff --git a/scripts/build.js b/scripts/build.js
index eed7e189..8e06c231 100644
--- a/scripts/build.js
+++ b/scripts/build.js
@@ -32,6 +32,7 @@ if (isCI && isPostInstall) {
process.exit(0);
}
+
// Ensure Python UTF-8 encoding
process.env.PYTHONUTF8 = '1';
@@ -61,11 +62,9 @@ function log(step, msg) {
}
function npmInstall(cwd = ROOT) {
- try {
- execSync('npm ci', { cwd, stdio: 'pipe', shell: true });
- } catch {
- execSync('npm install', { cwd, stdio: 'inherit', shell: true });
- }
+ // Use npm install directly with visible output
+ // npm ci requires package-lock.json which may not exist in all directories
+ execSync('npm install', { cwd, stdio: 'inherit', shell: true });
}
// ============================================================================