Installing Goose-CLI with Ollama for Local AI Coding

Posted last month
Return to overview

Before we dive in, let's clarify what we're setting up:

Goose-CLI is an open-source tool that acts as an autonomos coding assistant in your terminal. Think of it as having a colleague who can read your codebase, write code, run commands, and create files - all from the command line. Ollama is (in their own words) "Docker for AI models". It handles downloading, managing, and running large language models on your local machine. No cloud. No API costs. Complete privacy.

The model we're using (qwen2.5-coder:7b) is specifically trained for code generation, debugging, and understanding codebases. The 7b stands for the 7 billion parameters on the model that balance between performance and resource usage.

Installing Ollama

Let's start with Ollama, as we need it running before we configure Goose. Using Homebrew:

brew install ollama

Verify the installation worked:

ollama --version

Starting Ollama

On macOS, Ollama usually starts automatically after installation. You can verify it's running by checking if you can access:

curl http://localhost:11434

If you get a response saying "Ollama is running", you're good to go. If not, start it manually:

ollama serve

This starts the server on http://localhost:11434

Pulling the AI model

Now we can install a model. Open a terminal and pull it:

ollama pull qwen2.5-coder:7b

The model is roughly 4.7 GB, so grab a coffee while it downloads.

Verify it's installed:

ollama list

You should see qwen2.5-coder:7b listed with its size and download time.

Testing Ollama

Before we move on, let's make sure everything works:

ollama run qwen2.5-coder:7b "Write a TypeScript function that takes in two numbers and returns the product of the numbers"

If you see a code response, you're good! Press Ctrl+D or type /bye to exit.

Installing Goose-CLI

Now that Ollama is running, let's get Goose installed (again) using Homebrew:

brew install goose

Check it installed correctly:

goose --version

Configuring Goose with Ollama

This is where it gets interesting. Run the configuration wizard:

goose configure

You'll see an interactive menu. Here's what to do:

  1. Select "Configure Providers"

  2. Choose "Ollama"

  3. When asked for OLLAMA_HOST, just enter the defaults.

  4. Select qwen2.5-coder:7b as your model

That's it! Goose is now configured to use your local Ollama model.

Using your new setup

You're done! Here's how to use it:

Start a coding session:

goose session --name "name your session for easier retrieval"

List all your sessions:

goose list

Resume your last session:

goose resume {session_name}

What can Goose do?

Once you're in a Goose session, you can ask it to:

  • Read and understand your codebase

  • Write new features or functions

  • Debug existing code

  • Refactor code for better readability

  • Run terminal commands

  • Create and modify files

  • Generate tests

For example, you might say:

You: "Create a REST API endpoint for user authentication using TypeScript and Express.js"

And Goose will read your project structure, create the necessary files, and implement the functionality.

Practical tips ☝

  • Be specific in your requests. Instead of "fix this bug", try "fix the authentication bug where users can't log in with email addresses containing plus signs".

  • Reference your files. Goose can read your project, so you can say things like "Look at src/auth.js and add error handling for network timeouts".

  • Iterate on solutions. Start broad, then refine. "Create a web scraper" → "Add rate limiting" → "Add retry logic with exponential backoff".

  • Exit sessions cleanly. When you're done, type exit or press Ctrl+D to close your session properly.

Have fun!

Enjoyed this tutorial? I’m available for part-time remote work helping teams with architecture, web development (Vue/Nuxt preferred), performance and advocacy.

Return to overview