-
Notifications
You must be signed in to change notification settings - Fork 75
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·107 lines (87 loc) · 3.65 KB
/
install.sh
File metadata and controls
executable file
·107 lines (87 loc) · 3.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
#!/usr/bin/env bash
set -euo pipefail
REPO="RunanywhereAI/RCLI"
TAP="RunanywhereAI/rcli"
FORMULA="rcli"
info() { printf "\033[1;34m==>\033[0m \033[1m%s\033[0m\n" "$*"; }
ok() { printf "\033[1;32m==>\033[0m %s\n" "$*"; }
warn() { printf "\033[1;33mWarning:\033[0m %s\n" "$*"; }
fail() { printf "\033[1;31mError:\033[0m %s\n" "$*" >&2; exit 1; }
ENGINE_FLAG=""
while [[ $# -gt 0 ]]; do
case "$1" in
--engine)
ENGINE_FLAG="$2"; shift 2 ;;
--engine=*)
ENGINE_FLAG="${1#*=}"; shift ;;
*) shift ;;
esac
done
info "Checking latest RCLI release..."
VERSION=$(curl -fsSL "https://api.github.com/repos/${REPO}/releases/latest" \
| grep '"tag_name"' \
| sed 's/.*"v\([^"]*\)".*/\1/')
[[ -n "$VERSION" ]] || fail "Could not determine latest release version. Check your internet connection."
info "Latest version: v${VERSION}"
[[ "$(uname -s)" == "Darwin" ]] || fail "RCLI requires macOS. Detected: $(uname -s)"
arch=$(uname -m)
[[ "$arch" == "arm64" ]] || fail "RCLI requires Apple Silicon (M1+). Detected: $arch"
if ! command -v brew &>/dev/null; then
info "Installing Homebrew..."
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
eval "$(/opt/homebrew/bin/brew shellenv)"
fi
info "Tapping $TAP..."
brew tap "$TAP" "https://github.com/$REPO.git" 2>/dev/null || true
# Force-update the tap so Homebrew sees the latest formula
brew update --force 2>/dev/null || true
info "Installing RCLI v${VERSION}..."
if brew upgrade "$FORMULA" 2>/dev/null || brew install "$FORMULA" 2>/dev/null; then
ok "Installed via Homebrew"
else
warn "brew install failed (likely macOS 26 CLT issue). Installing manually..."
brew fetch "$FORMULA" 2>/dev/null || true
CACHED="$(brew --cache "$FORMULA" 2>/dev/null || true)"
if [[ -z "$CACHED" || ! -f "$CACHED" ]]; then
info "Downloading tarball directly..."
CACHED="/tmp/rcli-${VERSION}.tar.gz"
curl -fsSL -o "$CACHED" \
"https://github.com/$REPO/releases/download/v${VERSION}/rcli-${VERSION}-Darwin-arm64.tar.gz"
fi
WORKDIR=$(mktemp -d)
tar xzf "$CACHED" -C "$WORKDIR"
CELLAR="/opt/homebrew/Cellar/$FORMULA/$VERSION"
rm -rf "$CELLAR" 2>/dev/null || sudo rm -rf "$CELLAR"
mkdir -p "$CELLAR/bin" "$CELLAR/lib" 2>/dev/null || sudo mkdir -p "$CELLAR/bin" "$CELLAR/lib"
cp "$WORKDIR"/rcli-*/bin/rcli "$CELLAR/bin/" 2>/dev/null || sudo cp "$WORKDIR"/rcli-*/bin/rcli "$CELLAR/bin/"
cp "$WORKDIR"/rcli-*/bin/rcli_overlay "$CELLAR/bin/" 2>/dev/null || sudo cp "$WORKDIR"/rcli-*/bin/rcli_overlay "$CELLAR/bin/" 2>/dev/null || true
cp "$WORKDIR"/rcli-*/lib/*.dylib "$CELLAR/lib/" 2>/dev/null || sudo cp "$WORKDIR"/rcli-*/lib/*.dylib "$CELLAR/lib/"
brew link --overwrite "$FORMULA" 2>/dev/null || sudo brew link --overwrite "$FORMULA"
rm -rf "$WORKDIR"
ok "Installed manually into Homebrew Cellar"
fi
if ! command -v rcli &>/dev/null; then
fail "Installation failed. rcli not found in PATH."
fi
ok "RCLI v${VERSION} installed successfully"
echo ""
info "Setting up AI models and engine (one-time)..."
if [[ -n "$ENGINE_FLAG" ]]; then
case "$ENGINE_FLAG" in
llamacpp|1) echo "1" | rcli setup ;;
metalrt|2) echo "2" | rcli setup ;;
both|3) echo "3" | rcli setup ;;
*)
warn "Unknown engine '$ENGINE_FLAG'. Valid: llamacpp, metalrt, both"
rcli setup </dev/tty
;;
esac
else
# When piped (curl | bash), stdin is the pipe — redirect from /dev/tty
# so the user can interactively choose their engine.
if [[ -t 0 ]]; then
rcli setup
else
rcli setup </dev/tty
fi
fi