A lightweight Bash-based CLI tool for installing, running, and managing a local LanguageTool server. Provides simple commands to start, stop, restart, and check the status of your LanguageTool instance.
- Easy Installation: One-command bootstrap setup or manual installation
- Automatic Configuration: Creates
server.propertieswith sensible defaults during installation - Smart Version Detection: Handles LanguageTool's inconsistent version naming automatically
- Fast Downloads: Supports
aria2cfor parallel downloads with automatic fallback tocurl - Better Error Messages: Detailed diagnostics with automatic log display on failure
- Background Operation: Server runs in the background with PID tracking
Install quickly using the bootstrap script:
curl -fsSL https://raw.githubusercontent.com/c0dezer019/langtool-cli-runner/base/setup | bashThis will:
- Clone the repository to
~/.local/langtool-cli - Set up environment variables in
~/.config/environment.d/langtool-cli.conf - Create symlinks in
~/.local/bin(if in your PATH)
Clone the repo and set both LT_CLI_DIR (where the CLI lives) and LT_INSTALL_DIR (where LanguageTool will be installed):
# Clone the repository
git clone https://github.com/c0dezer019/langtool-cli.git "$HOME/.local/langtool-cli"
# Create configuration directory and file
mkdir -p "$HOME/.config/environment.d"
cat > "$HOME/.config/environment.d/langtool-cli.conf" <<'EOF'
LT_CLI_DIR="$HOME/.local/langtool-cli"
LT_INSTALL_DIR="$HOME/.local/share/LanguageTool"
EOF
# Load the config into the current shell
export LT_CLI_DIR="$HOME/.local/langtool-cli"
export LT_INSTALL_DIR="$HOME/.local/share/LanguageTool"
# Optional: Add to PATH for easy access
mkdir -p "$HOME/.local/bin"
ln -sf "$LT_CLI_DIR/langtool" "$HOME/.local/bin/langtool"
# Make variables persistent for future shells
echo 'export LT_CLI_DIR="$HOME/.local/langtool-cli"' >> ~/.bashrc
echo 'export LT_INSTALL_DIR="$HOME/.local/share/LanguageTool"' >> ~/.bashrcAfter installing the CLI, you need to download and install LanguageTool itself:
# Install the latest version (default)
langtool install
# Or install a specific version by date
langtool install 20251121This will:
- Download LanguageTool snapshot from
https://internal1.languagetool.org/snapshots/ - Extract it to your
$LT_INSTALL_DIR - Automatically create a
server.propertiesconfiguration file with sensible defaults - Offer to install
aria2cfor faster downloads (optional)
langtool start # Start server in background
langtool stop # Stop the server
langtool restart # Restart the server
langtool status # Show server status (running/not running)
langtool install # Install/update LanguageTool
langtool help # Show help informationlangtool start -v 6.8 # Start a specific installed version# First-time setup
langtool install # Download and install LanguageTool
langtool start # Start the server
# Later usage
langtool status # Check if running
langtool restart # Restart if needed
langtool stop # Stop when done| Variable | Description | Default |
|---|---|---|
LT_CLI_DIR |
Where the CLI scripts are located | (required) |
LT_INSTALL_DIR |
Where LanguageTool is installed | (required) |
LT_VER |
LanguageTool version to use | latest |
Set the LT_VER environment variable to control which LanguageTool version is used:
# Use latest version (default)
export LT_VER="latest"
# Use a specific date-based version
export LT_VER="20251121"
# Note: Version numbers like "6.8" may be used internally but
# the naming can vary between downloadsAdd this to your ~/.bashrc or ~/.zshrc to make it persistent.
After installation, you can customize the server settings by editing:
$LT_INSTALL_DIR/LanguageTool-<version>-snapshot/server.properties
Default configuration includes:
- Maximum text length: 50,000 characters
- Check timeout: 60 seconds
- Result caching: 10,000 entries
- Work queue size: 25 threads
See the LanguageTool HTTP Server documentation for all available options.
- Port: 8081 (hardcoded)
- PID File:
/tmp/langtool.pid - Log File:
$LT_INSTALL_DIR/LanguageTool-<version>-snapshot/languagetool.log - CORS: Enabled with
--allow-origin "*"(accepts requests from any origin)
If the server fails to start, the script will automatically display the last 10 lines of the log file. Common issues:
-
Port 8081 already in use:
# Check what's using the port lsof -i :8081 # Or try a different port (requires editing the script)
-
Java not installed:
# Install Java (Ubuntu/Debian) sudo apt install default-jre -
Missing server.properties:
# Reinstall to regenerate configuration langtool install
# View the full log
cat "$LT_INSTALL_DIR"/LanguageTool-*/languagetool.log
# Watch log in real-time
tail -f "$LT_INSTALL_DIR"/LanguageTool-*/languagetool.logThe script handles LanguageTool's inconsistent version naming automatically. If you encounter issues:
-
Check what's actually installed:
ls -la "$LT_INSTALL_DIR" -
The script will automatically find any installed LanguageTool version if the exact version isn't found
# Stop the server
langtool stop
# Remove PID file if stuck
rm -f /tmp/langtool.pid
# Uninstall LanguageTool
rm -rf "$LT_INSTALL_DIR/LanguageTool-"*
rm -rf "$LT_INSTALL_DIR/src"
# Reinstall
langtool installOnce the server is running, you can test it:
# Check if server is responding
curl http://localhost:8081/v2/check -d "language=en-US" -d "text=This is a test."
# Or use a more readable format
curl -X POST http://localhost:8081/v2/check \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "language=en-US" \
-d "text=I has a mistake"# Run without installing
bash lib/langtool start
bash lib/langtool status
bash lib/langtool stop# Check for syntax errors
bash -n langtool
# Or use shellcheck if installed
shellcheck langtool# Run the uninstall script
bash lib/uninstall
# Or manually:
rm -rf "$LT_CLI_DIR"
rm -rf "$LT_INSTALL_DIR"
rm -f "$HOME/.local/bin/langtool"
# Remove the export lines from your shell RC fileSee the repository for license information.
Contributions are welcome! Please open an issue or pull request on GitHub.