Installation Guide

Get started with TerminalAI powered by Google Gemini in just a few simple steps.

TerminalAI now features secure code execution capabilities powered by Google's Gemini AI.

Prerequisites

  • Node.js: Version 18.x or later recommended. Download from nodejs.org.
  • npm: Bundled with Node.js.
  • Git: (Optional, for cloning the repository).
  • Gemini API Key: Required for the default AI provider. Get one from Google AI Studio.

Installation Steps

1. Clone the Repository

First, clone the TerminalAI repository:

git clone https://github.com/yourusername/terminalai.git
cd terminalai

This will create a local copy of the latest version of TerminalAI.

Note: If you don't have Git installed, you can download the source code as a ZIP file from the GitHub repository.

2. Install Dependencies

Navigate to the project directory and install the required dependencies:

npm install

This will install all the necessary packages listed in package.json.

3. Link the Package (Optional but Recommended)

To make the tmai command available globally on your system:

npm link

This creates a symbolic link from the global node_modules directory to this package.

Note: On Linux/macOS, you might need to use sudo for global linking.

4. Verify Installation

Check that TerminalPal is installed correctly by running:

tpal --version

You should see the current version displayed.

Alternative: Install via npm

If you prefer, you can also install TerminalPal directly via npm:

npm install -g terminalpal

This will install the latest published version from the npm registry.

5. Set Up Your API Key

Before you can start using TerminalAI, you'll need to configure your Gemini API key:

tmai config set gemini_apiKey YOUR_API_KEY_HERE

Or you can run the interactive setup:

tmai setup
Security Note: Never share your API key or commit it to version control.

6. Start Using TerminalAI

You're all set! Start a chat session with:

tmai chat

Or ask a quick question directly:

tmai "How do I reverse a string in JavaScript?"

Development Setup

If you want to contribute to TerminalAI or work with the source code, follow these additional steps:

1. Install Development Dependencies

npm install --save-dev

2. Configure Environment

Create a .env file in the project root with your configuration:

# Required for Gemini provider
GEMINI_API_KEY=your_api_key_here

# Optional: Other provider API keys
OPENAI_API_KEY=your_openai_key
ANTHROPIC_API_KEY=your_anthropic_key

3. Run Tests

Verify everything is working by running the test suite:

npm test

4. Build the Project

To create a production build:

npm run build

Updating TerminalAI

To update TerminalPal to the latest version:

npm update -g terminalai
Note: If you installed manually via Git, update with git pull and then npm install.

Troubleshooting

If you encounter any issues during installation:

  • Make sure Node.js and npm are installed and in your PATH
  • Check that your API key is valid and properly set
  • Run with debug mode for more information: DEBUG=terminalai* tmai
  • Check the Troubleshooting Guide for common issues

Next Steps: Learn how to use TerminalPal in the Basic Usage Guide.