Installation
We provide two versions of Context Generator:
- a native binary
- a PHAR file.
The native binary is the recommended version, because it does not require PHP to be installed on your system. You can use it on Linux and MacOS.
The PHAR file can be used on any system with PHP 8.2 or higher.
Using bash (Recommended)
Requirements
- Linux,
- MacOS
- or Windows with or without WSL
The easiest way to install Context Generator is by using our installation script. This automatically downloads the latest version and sets it up for immediate use.
# Install to /usr/local/bin (will be added to PATH in most Linux distributions)
curl -sSL https://raw.githubusercontent.com/context-hub/generator/main/download-latest.sh | shWhat the script does
- Detects the latest version
- Downloads the binary file from GitHub releases
- Installs it (
ctx) to your bin directory (default:/usr/local/bin) - Makes it executable
If you install to a system directory like /usr/local/bin, you probably need sudo:
curl -sSL https://raw.githubusercontent.com/context-hub/generator/main/download-latest.sh | sudo shNote: When using
sudo, to run the script, you may need usesudoto run thectxcommand as well.
Install to a custom path to avoid using sudo:
curl -sSL https://raw.githubusercontent.com/context-hub/generator/main/download-latest.sh | sh -s $HOME/.local/binInstallation Location
macOS:
When installing ctx on macOS, the binary is installed to ~/.local/bin/ctx by default. However, this directory may not be in your system's PATH, which can cause issues when using ctx with applications like Claude Desktop.
Verifying Installation:
which ctx
# Should output: /Users/yourusername/.local/bin/ctxOption 1: Use Full Path (Recommended for MCP)
When configuring MCP servers in Claude Desktop or similar applications, use the full path to the ctx binary:
{
"mcpServers": {
"ctx": {
"command": "/Users/yourusername/.local/bin/ctx",
"args": ["server", "-c", "/path/to/your/project"]
}
}
}Option 2: Add to System PATH
To use ctx as a simple command everywhere, create a symlink in a system directory:
sudo ln -s ~/.local/bin/ctx /usr/local/bin/ctxOr add ~/.local/bin to your PATH by adding this line to ~/.zshrc (or ~/.bash_profile for bash):
export PATH="$HOME/.local/bin:$PATH"Then reload your shell:
source ~/.zshrcNote: Applications like Claude Desktop may not inherit your shell's PATH. In such cases, using the full path in the configuration is the most reliable approach.
Linux:
On Linux, ctx is typically installed to ~/.local/bin/ctx or /usr/local/bin/ctx depending on your installation method. The same PATH considerations apply as with macOS.
Troubleshooting:
If you encounter "command not found" errors:
- Verify ctx is installed:
ls -la ~/.local/bin/ctx - Check the binary is executable:
chmod +x ~/.local/bin/ctx - Use the full path in your configuration
- For shell usage, ensure
~/.local/binis in your PATH
After installation, you can use it by simply running the command to generate context:
ctxPHAR File
If you prefer to use a PHAR file, you can download the latest version from the GitHub releases page
Requirements
- PHP 8.2 or higher