DEV Community

Cover image for How to run DeepSeek Locally in Your Terminal Like a Pro
Aadarsh Nagrath
Aadarsh Nagrath

Posted on

16

How to run DeepSeek Locally in Your Terminal Like a Pro

If you've been looking for a way to use cutting-edge AI without relying on expensive cloud services, you're in luck! DeepSeek R1 is an open-source reasoning model that runs entirely on your local machine.

With a few simple steps, you can ditch online AI services and gain full control over your own AI assistant. In this guide, I'll show you how to get DeepSeek R1 running in your terminal using Ollama, the easiest way to run open-source models locally.

To follow me -
MY Github, Twitter

Step 1: Install Ollama

Before we can run DeepSeek, we need to install Ollama, which is a tool that lets you download and run AI models with a single command. Here's how you can install it based on your OS:

🖥️ macOS (with Homebrew)

brew install ollama
Enter fullscreen mode Exit fullscreen mode

🖥️ Linux (Debian/Ubuntu)

curl -fsSL https://ollama.com/install.sh | sh
Enter fullscreen mode Exit fullscreen mode

🖥️ Windows (via WSL)

For Windows, you'll need to install Windows Subsystem for Linux (WSL) and then run the Linux installation command inside WSL.

Once installed, restart your terminal and verify the installation by running:

ollama --version
Enter fullscreen mode Exit fullscreen mode

.

Step 2: Download & Run DeepSeek R1

DeepSeek R1 comes in different model sizes, ranging from 1.5 billion to a massive 671 billion parameters. Generally:

  • Smaller models (1.5B - 7B) → Fast but less powerful
  • Larger models (67B - 671B) → Smarter but require high-end GPUs

To get started, let's download and run the 7B model, which is a good balance between performance and intelligence:

ollama run deepseek-r1:7b
Enter fullscreen mode Exit fullscreen mode

This command does two things:

  1. Downloads the 7B model (only the first time you run it)
  2. Starts an interactive chat session with DeepSeek R1 in your terminal

If you want a lighter version, you can try:

ollama run deepseek-r1:1.5b
Enter fullscreen mode Exit fullscreen mode

And if you have a powerful setup and want maximum reasoning power, go for:

ollama run deepseek-r1:67b
Enter fullscreen mode Exit fullscreen mode

(Just make sure you have enough VRAM, as the largest models require high-end GPUs!)

Step 3: Use DeepSeek R1 in the Terminal

Once the model starts, you'll see a chat-like interface where you can ask it anything:

> How does quicksort work?
Enter fullscreen mode Exit fullscreen mode

DeepSeek will generate a detailed response in real-time!

Customize Your Experience

Ollama provides options to tweak the AI’s behavior. Here are some useful parameters:

.

  • Set a custom system prompt
  ollama run deepseek-r1 --system "You are an expert software engineer. Answer concisely."
Enter fullscreen mode Exit fullscreen mode
  • Use temperature for randomness (higher = more creative)
  ollama run deepseek-r1 --temperature 0.7
Enter fullscreen mode Exit fullscreen mode
  • Limit response length
  ollama run deepseek-r1 --max-tokens 256
Enter fullscreen mode Exit fullscreen mode

Step 4: Run DeepSeek R1 in API Mode

Want to use DeepSeek programmatically? Ollama provides an API mode:

ollama serve
Enter fullscreen mode Exit fullscreen mode

This starts a local API server. Now, you can send requests using cURL:

curl http://localhost:11434/api/generate -d '{"model": "deepseek-r1:7b", "prompt": "Explain recursion."}'
Enter fullscreen mode Exit fullscreen mode

Or integrate it into your Python/Node.js projects.

Conclusion

Congratulations! You just installed, configured, and ran DeepSeek R1 locally in your terminal. Now, you have an open-source AI assistant at your fingertips—no internet, no cloud fees, just raw AI power on your machine.

Go ahead, experiment with different model sizes, tweak the settings, and enjoy the power of local AI! 🚀

Playwright CLI Flags Tutorial

5 Playwright CLI Flags That Will Transform Your Testing Workflow

  • 0:56 --last-failed: Zero in on just the tests that failed in your previous run
  • 2:34 --only-changed: Test only the spec files you've modified in git
  • 4:27 --repeat-each: Run tests multiple times to catch flaky behavior before it reaches production
  • 5:15 --forbid-only: Prevent accidental test.only commits from breaking your CI pipeline
  • 5:51 --ui --headed --workers 1: Debug visually with browser windows and sequential test execution

Learn how these powerful command-line options can save you time, strengthen your test suite, and streamline your Playwright testing experience. Click on any timestamp above to jump directly to that section in the tutorial!

Watch Full Video 📹️

Top comments (3)

Collapse
 
daniel_sembiring_f64c10e7 profile image
Daniel sembiring

Cleaning up old version at /usr/local/lib/ollama

Installing ollama to /usr/local
Downloading Linux amd64 bundle

########################################################### 90.9%curl: (92) HTTP/2 stream 1 was not closed cleanly: PROTOCOL_ERROR (err 1)

i have problem


Collapse
 
jagoum profile image
Jagoum

How do i stop ollama from running

Collapse
 
aadarsh-nagrath profile image
Aadarsh Nagrath

to remove - ollama rm deepseek-r1:1.5b
Kill the Ollama Process -> taskkill /F /IM ollama.exe (windows)
pkill -f ollama (linux/macOs)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Explore a trove of insights in this engaging article, celebrated within our welcoming DEV Community. Developers from every background are invited to join and enhance our shared wisdom.

A genuine "thank you" can truly uplift someone’s day. Feel free to express your gratitude in the comments below!

On DEV, our collective exchange of knowledge lightens the road ahead and strengthens our community bonds. Found something valuable here? A small thank you to the author can make a big difference.

Okay