Skip to content

Commit 45eb6d4

Browse files
committed
Add one-line installer script with macOS signing fix
install.sh detects OS/arch, downloads latest release, fixes macOS code signing (removes quarantine/provenance xattrs, re-signs locally), installs to ~/.local/bin, and configures all detected coding agents. Supports --ui flag for graph visualization variant and --dir for custom install path. Handles both curl and wget. Update README Quick Start with one-liner curl | bash usage.
1 parent f24475c commit 45eb6d4

2 files changed

Lines changed: 209 additions & 1 deletion

File tree

README.md

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,21 @@ High-quality parsing through [tree-sitter](https://tree-sitter.github.io/tree-si
3333

3434
## Quick Start
3535

36+
**One-line install** (macOS / Linux):
37+
```bash
38+
curl -fsSL https://raw.githubusercontent.com/DeusData/codebase-memory-mcp/main/install.sh | bash
39+
```
40+
41+
With graph visualization UI:
42+
```bash
43+
curl -fsSL https://raw.githubusercontent.com/DeusData/codebase-memory-mcp/main/install.sh | bash -s -- --ui
44+
```
45+
46+
Restart your coding agent. Say **"Index this project"** — done.
47+
48+
<details>
49+
<summary>Manual install</summary>
50+
3651
1. **Download** the binary for your platform from the [latest release](https://github.com/DeusData/codebase-memory-mcp/releases/latest):
3752
- `codebase-memory-mcp-<os>-<arch>.tar.gz` — standard (MCP server only)
3853
- `codebase-memory-mcp-ui-<os>-<arch>.tar.gz` — with embedded graph visualization
@@ -44,7 +59,15 @@ High-quality parsing through [tree-sitter](https://tree-sitter.github.io/tree-si
4459
codebase-memory-mcp install
4560
```
4661

47-
3. **Restart** your coding agent. Say **"Index this project"** — done.
62+
3. **Restart** your coding agent.
63+
64+
On macOS, if the binary is killed on launch, fix code signing:
65+
```bash
66+
xattr -d com.apple.quarantine ~/.local/bin/codebase-memory-mcp
67+
xattr -d com.apple.provenance ~/.local/bin/codebase-memory-mcp
68+
codesign --force --sign - ~/.local/bin/codebase-memory-mcp
69+
```
70+
</details>
4871

4972
The `install` command auto-detects all installed coding agents and configures MCP server entries, instruction files, skills, and pre-tool hooks for each.
5073

install.sh

Lines changed: 185 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,185 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
# install.sh — One-line installer for codebase-memory-mcp.
5+
#
6+
# Usage:
7+
# curl -fsSL https://raw.githubusercontent.com/DeusData/codebase-memory-mcp/main/install.sh | bash
8+
# curl -fsSL ... | bash -s -- --ui # Install the UI variant (graph visualization)
9+
# curl -fsSL ... | bash -s -- --dir /usr/local/bin # Custom install directory
10+
#
11+
# What it does:
12+
# 1. Detects OS (macOS/Linux/Windows) and architecture (arm64/amd64)
13+
# 2. Downloads the latest release binary from GitHub
14+
# 3. On macOS: removes quarantine/provenance xattrs, re-signs locally
15+
# 4. Installs to ~/.local/bin (or custom --dir)
16+
# 5. Runs `codebase-memory-mcp install` to configure all detected coding agents
17+
18+
REPO="DeusData/codebase-memory-mcp"
19+
INSTALL_DIR="$HOME/.local/bin"
20+
VARIANT="standard"
21+
22+
# ── Parse arguments ──────────────────────────────────────────
23+
for arg in "$@"; do
24+
case "$arg" in
25+
--ui) VARIANT="ui" ;;
26+
--standard) VARIANT="standard" ;;
27+
--dir=*) INSTALL_DIR="${arg#--dir=}" ;;
28+
--dir) shift; INSTALL_DIR="$1" ;;
29+
--help|-h)
30+
echo "Usage: install.sh [--ui] [--dir <path>]"
31+
echo " --ui Install the UI variant (with graph visualization)"
32+
echo " --standard Install the standard variant (default)"
33+
echo " --dir PATH Install directory (default: ~/.local/bin)"
34+
exit 0
35+
;;
36+
esac
37+
done
38+
39+
# ── Detect OS ────────────────────────────────────────────────
40+
detect_os() {
41+
case "$(uname -s)" in
42+
Darwin) echo "darwin" ;;
43+
Linux) echo "linux" ;;
44+
MINGW*|MSYS*|CYGWIN*) echo "windows" ;;
45+
*)
46+
echo "error: unsupported OS: $(uname -s)" >&2
47+
exit 1
48+
;;
49+
esac
50+
}
51+
52+
# ── Detect architecture ──────────────────────────────────────
53+
detect_arch() {
54+
case "$(uname -m)" in
55+
arm64|aarch64) echo "arm64" ;;
56+
x86_64|amd64)
57+
# On macOS, check if this is Apple Silicon running under Rosetta
58+
if [ "$(uname -s)" = "Darwin" ] && sysctl -n machdep.cpu.brand_string 2>/dev/null | grep -qi apple; then
59+
echo "arm64"
60+
else
61+
echo "amd64"
62+
fi
63+
;;
64+
*)
65+
echo "error: unsupported architecture: $(uname -m)" >&2
66+
exit 1
67+
;;
68+
esac
69+
}
70+
71+
OS=$(detect_os)
72+
ARCH=$(detect_arch)
73+
74+
echo "codebase-memory-mcp installer"
75+
echo " os: $OS"
76+
echo " arch: $ARCH"
77+
echo " variant: $VARIANT"
78+
echo " target: $INSTALL_DIR/codebase-memory-mcp"
79+
echo ""
80+
81+
# ── Build download URL ───────────────────────────────────────
82+
if [ "$OS" = "windows" ]; then
83+
EXT="zip"
84+
else
85+
EXT="tar.gz"
86+
fi
87+
88+
if [ "$VARIANT" = "ui" ]; then
89+
ARCHIVE="codebase-memory-mcp-ui-${OS}-${ARCH}.${EXT}"
90+
else
91+
ARCHIVE="codebase-memory-mcp-${OS}-${ARCH}.${EXT}"
92+
fi
93+
94+
URL="https://github.com/${REPO}/releases/latest/download/${ARCHIVE}"
95+
96+
# ── Download ─────────────────────────────────────────────────
97+
TMPDIR=$(mktemp -d)
98+
trap 'rm -rf "$TMPDIR"' EXIT
99+
100+
echo "Downloading ${ARCHIVE}..."
101+
if command -v curl &>/dev/null; then
102+
curl -fSL --progress-bar -o "$TMPDIR/$ARCHIVE" "$URL"
103+
elif command -v wget &>/dev/null; then
104+
wget -q --show-progress -O "$TMPDIR/$ARCHIVE" "$URL"
105+
else
106+
echo "error: curl or wget required" >&2
107+
exit 1
108+
fi
109+
110+
# ── Extract ──────────────────────────────────────────────────
111+
echo "Extracting..."
112+
cd "$TMPDIR"
113+
if [ "$EXT" = "zip" ]; then
114+
unzip -q "$ARCHIVE"
115+
else
116+
tar -xzf "$ARCHIVE"
117+
fi
118+
119+
BINARY="$TMPDIR/codebase-memory-mcp"
120+
if [ "$OS" = "windows" ] && [ -f "$TMPDIR/codebase-memory-mcp.exe" ]; then
121+
BINARY="$TMPDIR/codebase-memory-mcp.exe"
122+
fi
123+
124+
if [ ! -f "$BINARY" ]; then
125+
echo "error: binary not found after extraction" >&2
126+
exit 1
127+
fi
128+
129+
# ── macOS: fix signing ───────────────────────────────────────
130+
if [ "$OS" = "darwin" ]; then
131+
echo "Fixing macOS code signing..."
132+
133+
# Remove quarantine and provenance xattrs (set by browsers/curl on macOS)
134+
xattr -d com.apple.quarantine "$BINARY" 2>/dev/null || true
135+
xattr -d com.apple.provenance "$BINARY" 2>/dev/null || true
136+
137+
# Re-sign locally with ad-hoc signature (required for Apple Silicon)
138+
codesign --force --sign - "$BINARY" 2>/dev/null || true
139+
fi
140+
141+
# ── Install ──────────────────────────────────────────────────
142+
mkdir -p "$INSTALL_DIR"
143+
DEST="$INSTALL_DIR/codebase-memory-mcp"
144+
if [ "$OS" = "windows" ]; then
145+
DEST="${DEST}.exe"
146+
fi
147+
148+
# Remove old binary if present (handles read-only files)
149+
if [ -f "$DEST" ]; then
150+
rm -f "$DEST"
151+
fi
152+
153+
cp "$BINARY" "$DEST"
154+
chmod 755 "$DEST"
155+
156+
# Verify binary runs
157+
echo ""
158+
VERSION=$("$DEST" --version 2>&1) || {
159+
echo "error: installed binary failed to run" >&2
160+
echo " try: xattr -cr $DEST && codesign --force --sign - $DEST" >&2
161+
exit 1
162+
}
163+
echo "Installed: $VERSION"
164+
165+
# ── Run install subcommand ───────────────────────────────────
166+
echo ""
167+
echo "Configuring coding agents..."
168+
"$DEST" install -y 2>&1 || {
169+
echo ""
170+
echo "Agent configuration failed (non-fatal)."
171+
echo "You can run it manually: codebase-memory-mcp install"
172+
}
173+
174+
# ── PATH check ───────────────────────────────────────────────
175+
if ! echo "$PATH" | tr ':' '\n' | grep -qx "$INSTALL_DIR"; then
176+
echo ""
177+
echo "NOTE: $INSTALL_DIR is not in your PATH."
178+
echo "Add it to your shell config:"
179+
echo ""
180+
echo " echo 'export PATH=\"$INSTALL_DIR:\$PATH\"' >> ~/.zshrc"
181+
echo ""
182+
fi
183+
184+
echo ""
185+
echo "Done! Restart your coding agent to start using codebase-memory-mcp."

0 commit comments

Comments
 (0)