diff --git a/README.md b/README.md index 449d40de..86c7f5ed 100644 --- a/README.md +++ b/README.md @@ -21,13 +21,17 @@ Create and run high-performance macOS and Linux VMs on Apple Silicon, with built | Library | Description | Installation | Version | |---------|-------------|--------------|---------| -| [**Lume**](./libs/lume/README.md) | CLI for running macOS/Linux VMs with near-native performance using Apple's `Virtualization.Framework`. | `brew install lume` | [![brew](https://img.shields.io/homebrew/v/lume?color=333333)](https://formulae.brew.sh/formula/lume) | +| [**Lume**](./libs/lume/README.md) | CLI for running macOS/Linux VMs with near-native performance using Apple's `Virtualization.Framework`. | [![Download](https://img.shields.io/badge/Download-333333?style=for-the-badge&logo=github&logoColor=white)](https://github.com/trycua/cua/releases/latest/download/lume.pkg.tar.gz) | [![GitHub release](https://img.shields.io/github/v/release/trycua/cua?color=333333)](https://github.com/trycua/cua/releases) | | [**Computer**](./libs/computer/README.md) | Computer-Use Interface (CUI) framework for interacting with macOS/Linux sandboxes | `pip install cua-computer` | [![PyPI](https://img.shields.io/pypi/v/cua-computer?color=333333)](https://pypi.org/project/cua-computer/) | | [**Agent**](./libs/agent/README.md) | Computer-Use Agent (CUA) framework for running agentic workflows in macOS/Linux dedicated sandboxes | `pip install cua-agent` | [![PyPI](https://img.shields.io/pypi/v/cua-agent?color=333333)](https://pypi.org/project/cua-agent/) | ## Lume -**Originally looking for Lume?** If you're here for the original Lume project, it's now part of this monorepo. Simply install with `brew` and refer to its [documentation](./libs/lume/README.md). +**Originally looking for Lume?** If you're here for the original Lume project, it's now part of this monorepo. Simply install with our one-line installer script and refer to its [documentation](./libs/lume/README.md): + +```bash +/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/trycua/cua/main/libs/lume/scripts/install.sh)" +``` ## Docs diff --git a/libs/lume/README.md b/libs/lume/README.md index 869ef791..a7305c74 100644 --- a/libs/lume/README.md +++ b/libs/lume/README.md @@ -100,9 +100,10 @@ Command Options: ## Install +Install with a single command: + ```bash -brew tap trycua/lume -brew install lume +/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/trycua/cua/main/libs/lume/scripts/install.sh)" ``` You can also download the `lume.pkg.tar.gz` archive from the [latest release](https://github.com/trycua/lume/releases), extract it, and install the package manually. diff --git a/libs/lume/scripts/install.sh b/libs/lume/scripts/install.sh new file mode 100644 index 00000000..80ff3ff8 --- /dev/null +++ b/libs/lume/scripts/install.sh @@ -0,0 +1,164 @@ +#!/bin/bash +set -e + +# Lume Installer +# This script installs Lume to your system + +# Define colors for output +BOLD=$(tput bold) +NORMAL=$(tput sgr0) +RED=$(tput setaf 1) +GREEN=$(tput setaf 2) +BLUE=$(tput setaf 4) + +# Default installation directory +DEFAULT_INSTALL_DIR="/usr/local/bin" +INSTALL_DIR="${INSTALL_DIR:-$DEFAULT_INSTALL_DIR}" + +# GitHub info +GITHUB_REPO="trycua/cua" +LATEST_RELEASE_URL="https://api.github.com/repos/$GITHUB_REPO/releases/latest" + +echo "${BOLD}${BLUE}Lume Installer${NORMAL}" +echo "This script will install Lume to your system." + +# Check if we're running with appropriate permissions +check_permissions() { + if [ "$INSTALL_DIR" = "$DEFAULT_INSTALL_DIR" ] && [ "$(id -u)" != "0" ]; then + echo "${RED}Error: Installing to $INSTALL_DIR requires root privileges.${NORMAL}" + echo "Please run with sudo or specify a different directory with INSTALL_DIR environment variable." + echo "Example: INSTALL_DIR=\$HOME/.local/bin $0" + exit 1 + fi +} + +# Detect OS and architecture +detect_platform() { + OS=$(uname -s | tr '[:upper:]' '[:lower:]') + ARCH=$(uname -m) + + if [ "$OS" != "darwin" ]; then + echo "${RED}Error: Currently only macOS is supported.${NORMAL}" + exit 1 + fi + + if [ "$ARCH" != "arm64" ]; then + echo "${RED}Error: Lume only supports macOS on Apple Silicon (ARM64).${NORMAL}" + exit 1 + fi + + PLATFORM="darwin-arm64" + echo "Detected platform: ${BOLD}$PLATFORM${NORMAL}" +} + +# Create temporary directory +create_temp_dir() { + TEMP_DIR=$(mktemp -d) + echo "Using temporary directory: $TEMP_DIR" + + # Make sure we clean up on exit + trap 'rm -rf "$TEMP_DIR"' EXIT +} + +# Download the latest release +download_release() { + echo "Fetching latest release information..." + + # Try to get the latest version from GitHub API + if command -v curl &> /dev/null; then + RELEASE_INFO=$(curl -s "$LATEST_RELEASE_URL") + VERSION=$(echo "$RELEASE_INFO" | grep -o '"tag_name": "v[^"]*"' | cut -d'"' -f4 | sed 's/^v//') + + if [ -z "$VERSION" ]; then + echo "${RED}Failed to get latest version.${NORMAL} Using direct download link." + # Try simpler URL with the non-versioned symlink + DOWNLOAD_URL="https://github.com/$GITHUB_REPO/releases/latest/download/lume.tar.gz" + else + echo "Latest version: ${BOLD}$VERSION${NORMAL}" + DOWNLOAD_URL="https://github.com/$GITHUB_REPO/releases/download/v$VERSION/lume.tar.gz" + fi + else + echo "${RED}curl not found.${NORMAL} Using direct download link." + DOWNLOAD_URL="https://github.com/$GITHUB_REPO/releases/latest/download/lume.tar.gz" + fi + + echo "Downloading from: $DOWNLOAD_URL" + + # Download the tarball + if command -v curl &> /dev/null; then + curl -L --progress-bar "$DOWNLOAD_URL" -o "$TEMP_DIR/lume.tar.gz" + + # Verify the download was successful + if [ ! -s "$TEMP_DIR/lume.tar.gz" ]; then + echo "${RED}Error: Failed to download Lume.${NORMAL}" + echo "The download URL may be incorrect or the file may not exist." + exit 1 + fi + + # Verify the file is a valid archive + if ! tar -tzf "$TEMP_DIR/lume.tar.gz" > /dev/null 2>&1; then + echo "${RED}Error: The downloaded file is not a valid tar.gz archive.${NORMAL}" + echo "Let's try the alternative URL..." + + # Try alternative URL + ALT_DOWNLOAD_URL="https://github.com/$GITHUB_REPO/releases/latest/download/lume-$PLATFORM.tar.gz" + echo "Downloading from alternative URL: $ALT_DOWNLOAD_URL" + curl -L --progress-bar "$ALT_DOWNLOAD_URL" -o "$TEMP_DIR/lume.tar.gz" + + # Check again + if ! tar -tzf "$TEMP_DIR/lume.tar.gz" > /dev/null 2>&1; then + echo "${RED}Error: Could not download a valid Lume archive.${NORMAL}" + echo "Please try installing Lume manually from: https://github.com/$GITHUB_REPO/releases/latest" + exit 1 + fi + fi + else + echo "${RED}Error: curl is required but not installed.${NORMAL}" + exit 1 + fi +} + +# Extract and install +install_binary() { + echo "Extracting archive..." + tar -xzf "$TEMP_DIR/lume.tar.gz" -C "$TEMP_DIR" + + echo "Installing to $INSTALL_DIR..." + + # Create install directory if it doesn't exist + mkdir -p "$INSTALL_DIR" + + # Move the binary to the installation directory + mv "$TEMP_DIR/lume" "$INSTALL_DIR/" + + # Make the binary executable + chmod +x "$INSTALL_DIR/lume" + + echo "${GREEN}Installation complete!${NORMAL}" + echo "Lume has been installed to ${BOLD}$INSTALL_DIR/lume${NORMAL}" + + # Check if the installation directory is in PATH + if [ -n "${PATH##*$INSTALL_DIR*}" ]; then + echo "${RED}Warning: $INSTALL_DIR is not in your PATH.${NORMAL}" + echo "You may need to add it to your shell profile:" + echo " For bash: echo 'export PATH=\"\$PATH:$INSTALL_DIR\"' >> ~/.bash_profile" + echo " For zsh: echo 'export PATH=\"\$PATH:$INSTALL_DIR\"' >> ~/.zshrc" + echo " For fish: echo 'fish_add_path $INSTALL_DIR' >> ~/.config/fish/config.fish" + fi +} + +# Main installation flow +main() { + check_permissions + detect_platform + create_temp_dir + download_release + install_binary + + echo "" + echo "${GREEN}${BOLD}Lume has been successfully installed!${NORMAL}" + echo "Run ${BOLD}lume${NORMAL} to get started." +} + +# Run the installation +main \ No newline at end of file