-
Notifications
You must be signed in to change notification settings - Fork 24
Expand file tree
/
Copy pathinstall-codegraph-local-speed-osx.sh
More file actions
executable file
·64 lines (51 loc) · 2.13 KB
/
install-codegraph-local-speed-osx.sh
File metadata and controls
executable file
·64 lines (51 loc) · 2.13 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
#!/bin/bash
# ABOUTME: Builds the CodeGraph CLI from source with the fast local preset on macOS.
# ABOUTME: Produces a release binary, installs it into \$CODEGRAPH_INSTALL_DIR, and documents SurrealDB-only setup.
set -euo pipefail
FEATURE_FLAGS="--all-features"
INSTALL_DIR="${CODEGRAPH_INSTALL_DIR:-$HOME/.local/bin}"
TARGET_BIN="target/release/codegraph"
info() { printf '[INFO] %s\n' "$1"; }
warn() { printf '[WARN] %s\n' "$1"; }
fail() { printf '[ERROR] %s\n' "$1"; exit 1; }
info "Building CodeGraph (local speed preset)"
[[ "${OSTYPE:-}" == darwin* ]] || fail "This script is optimized for macOS."
command -v brew >/dev/null 2>&1 || fail "Homebrew is required (https://brew.sh)."
command -v cargo >/dev/null 2>&1 || fail "Rust is required (https://rustup.rs)."
if ! command -v surreal >/dev/null 2>&1; then
warn "SurrealDB CLI not found; installing via Homebrew..."
brew install surrealdb/tap/surreal >/dev/null
info "SurrealDB CLI installed"
else
info "SurrealDB CLI detected"
fi
export MACOSX_DEPLOYMENT_TARGET=11.0
info "Running cargo build --release with features: ${FEATURE_FLAGS}"
cargo build --release \
--package codegraph-mcp-server \
--bin codegraph \
${FEATURE_FLAGS}
test -f "${TARGET_BIN}" || fail "Release binary was not produced at ${TARGET_BIN}"
info "Copying binary to ${INSTALL_DIR}"
mkdir -p "${INSTALL_DIR}"
cp -f "${TARGET_BIN}" "${INSTALL_DIR}/codegraph"
chmod +x "${INSTALL_DIR}/codegraph"
info "CodeGraph ready at ${INSTALL_DIR}/codegraph"
cat <<EOF
Next steps
----------
1. Start SurrealDB before indexing:
surreal start --log trace file://\$HOME/.codegraph/surreal.db
2. Create a .env file per repository:
CODEGRAPH_SURREALDB_URL=ws://localhost:3004
CODEGRAPH_SURREALDB_NAMESPACE=ouroboros
CODEGRAPH_SURREALDB_DATABASE=codegraph
CODEGRAPH_EMBEDDING_PROVIDER=ollama
CODEGRAPH_LLM_PROVIDER=ollama
3. Warm up your project:
codegraph index . --force
4. Launch the MCP server:
codegraph start stdio # Claude Desktop
codegraph start http --port 3000
Add ${INSTALL_DIR} to your PATH (e.g. export PATH="${INSTALL_DIR}:\$PATH") if it is not already available.
EOF