|
44 | 44 | if command -v llama-server &>/dev/null; then |
45 | 45 | ok "llama-server installed" |
46 | 46 | else |
47 | | - info "Installing llama.cpp..." |
48 | | - if command -v brew &>/dev/null && brew install llama.cpp 2>/dev/null; then |
49 | | - ok "llama.cpp installed via Homebrew" |
| 47 | + info "Installing llama.cpp from GitHub release..." |
| 48 | + OS_NAME="$(uname -s | tr '[:upper:]' '[:lower:]')" |
| 49 | + ARCH_NAME="$(uname -m)" |
| 50 | + LLAMA_REPO="ggerganov/llama.cpp" |
| 51 | + LLAMA_TAG=$(curl -fsSL "https://api.github.com/repos/$LLAMA_REPO/releases/latest" 2>/dev/null | grep '"tag_name"' | head -1 | sed -E 's/.*"([^"]+)".*/\1/' || echo "") |
| 52 | + if [[ -z "$LLAMA_TAG" ]]; then |
| 53 | + fail "Could not determine latest llama.cpp release" |
| 54 | + exit 1 |
| 55 | + fi |
| 56 | + if [[ "$OS_NAME" == "darwin" ]]; then |
| 57 | + LLAMA_ASSET="llama-${LLAMA_TAG}-bin-macos-arm64.tar.gz" |
| 58 | + [[ "$ARCH_NAME" == "x86_64" ]] && LLAMA_ASSET="llama-${LLAMA_TAG}-bin-macos-x64.tar.gz" |
50 | 59 | else |
51 | | - info "Homebrew install failed or unavailable, downloading from GitHub..." |
52 | | - OS_NAME="$(uname -s | tr '[:upper:]' '[:lower:]')" |
53 | | - ARCH_NAME="$(uname -m)" |
54 | | - LLAMA_REPO="ggerganov/llama.cpp" |
55 | | - LLAMA_TAG=$(curl -fsSL "https://api.github.com/repos/$LLAMA_REPO/releases/latest" 2>/dev/null | grep '"tag_name"' | head -1 | sed -E 's/.*"([^"]+)".*/\1/' || echo "") |
56 | | - if [[ -z "$LLAMA_TAG" ]]; then |
57 | | - fail "Could not determine latest llama.cpp release" |
58 | | - exit 1 |
59 | | - fi |
60 | | - if [[ "$OS_NAME" == "darwin" ]]; then |
61 | | - LLAMA_ASSET="llama-${LLAMA_TAG}-bin-macos-arm64.zip" |
62 | | - [[ "$ARCH_NAME" == "x86_64" ]] && LLAMA_ASSET="llama-${LLAMA_TAG}-bin-macos-x64.zip" |
63 | | - else |
64 | | - LLAMA_ASSET="llama-${LLAMA_TAG}-bin-ubuntu-x64.zip" |
65 | | - [[ "$ARCH_NAME" == "aarch64" || "$ARCH_NAME" == "arm64" ]] && LLAMA_ASSET="llama-${LLAMA_TAG}-bin-ubuntu-arm64.zip" |
66 | | - fi |
67 | | - LLAMA_TMPDIR=$(mktemp -d) |
68 | | - curl -fL --progress-bar -o "$LLAMA_TMPDIR/$LLAMA_ASSET" "https://github.com/$LLAMA_REPO/releases/download/${LLAMA_TAG}/${LLAMA_ASSET}" |
69 | | - unzip -q "$LLAMA_TMPDIR/$LLAMA_ASSET" -d "$LLAMA_TMPDIR/llama" |
70 | | - LLAMA_SERVER=$(find "$LLAMA_TMPDIR/llama" -name "llama-server" -type f | head -1) |
71 | | - if [[ -z "$LLAMA_SERVER" ]]; then |
72 | | - fail "llama-server not found in release archive" |
73 | | - rm -rf "$LLAMA_TMPDIR" |
74 | | - exit 1 |
75 | | - fi |
76 | | - chmod +x "$LLAMA_SERVER" |
77 | | - sudo cp "$LLAMA_SERVER" /usr/local/bin/llama-server |
| 60 | + LLAMA_ASSET="llama-${LLAMA_TAG}-bin-ubuntu-x64.tar.gz" |
| 61 | + fi |
| 62 | + LLAMA_TMPDIR=$(mktemp -d) |
| 63 | + curl -fL --progress-bar -o "$LLAMA_TMPDIR/$LLAMA_ASSET" "https://github.com/$LLAMA_REPO/releases/download/${LLAMA_TAG}/${LLAMA_ASSET}" |
| 64 | + mkdir -p "$LLAMA_TMPDIR/llama" |
| 65 | + tar -xzf "$LLAMA_TMPDIR/$LLAMA_ASSET" -C "$LLAMA_TMPDIR/llama" |
| 66 | + LLAMA_SERVER=$(find "$LLAMA_TMPDIR/llama" -name "llama-server" -type f | head -1) |
| 67 | + if [[ -z "$LLAMA_SERVER" ]]; then |
| 68 | + fail "llama-server not found in release archive" |
78 | 69 | rm -rf "$LLAMA_TMPDIR" |
79 | | - ok "llama-server → /usr/local/bin/llama-server" |
| 70 | + exit 1 |
80 | 71 | fi |
| 72 | + chmod +x "$LLAMA_SERVER" |
| 73 | + sudo cp "$LLAMA_SERVER" /usr/local/bin/llama-server |
| 74 | + rm -rf "$LLAMA_TMPDIR" |
| 75 | + ok "llama-server → /usr/local/bin/llama-server" |
81 | 76 | fi |
82 | 77 |
|
83 | 78 | # Docker (only required when not using Atlas) |
|
0 commit comments