Skip to content

opsdev-ws/flatpak-claude

Repository files navigation

Claude Code CLI - Flatpak Repository

This repository provides Claude Code CLI as a flatpak package, enabling you to run Claude within sandboxed environments like VSCode, VSCodium, Cursor, and other flatpak applications.

Main Goals

  1. Run Claude Code CLI in flatpak sandboxes/containers - Works reliably in flatpak-based IDEs (VSCode, VSCodium, Cursor, GNOME Builder, etc.)

  2. Flexible configuration via CLAUDE_CONFIG_DIR - Point to different .claude directories for isolated projects or shared configurations

Key Features

  • ✅ Works inside flatpak IDEs and terminals
  • ✅ Multi-architecture support (x86_64 and ARM64)
  • ✅ Configurable config directory via environment variable
  • ✅ Shares config with host installation (by default)
  • ✅ Downloads from npm registry (reproducible builds)

Installation (Recommended)

1. Add the Repository

flatpak remote-add --user --no-gpg-verify claude-repo https://opsdev-ws.github.io/flatpak-claude

2. Install Claude Code

flatpak install --user claude-repo com.anthropic.ClaudeCode

3. Run Claude Code

flatpak run com.anthropic.ClaudeCode

4. Create an Alias (Optional)

alias claude='flatpak run com.anthropic.ClaudeCode'

Using in Flatpak IDEs (e.g., VSCodium)

If you're using a flatpak IDE like VSCodium, you need to grant it permission to run other flatpaks:

# Grant VSCodium permission to run flatpaks
flatpak override --user com.vscodium.codium --talk-name=org.freedesktop.Flatpak

Now from VSCodium's integrated terminal:

flatpak run com.anthropic.ClaudeCode

Or create an alias in your shell config (~/.bashrc or ~/.zshrc):

alias claude='flatpak run com.anthropic.ClaudeCode'

Configuration: Using Different .claude Directories

By default, this flatpak uses ~/.claude for configuration. You can change this using the CLAUDE_CONFIG_DIR environment variable.

Default Behavior

# Uses ~/.claude
flatpak run com.anthropic.ClaudeCode

Point to a Different Directory

# Use a project-specific config
flatpak run --env=CLAUDE_CONFIG_DIR=/path/to/project/.claude com.anthropic.ClaudeCode

Multiple Configurations

# Work config
alias claude-work='flatpak run --env=CLAUDE_CONFIG_DIR=$HOME/.claude-work com.anthropic.ClaudeCode'

# Personal config
alias claude-personal='flatpak run --env=CLAUDE_CONFIG_DIR=$HOME/.claude-personal com.anthropic.ClaudeCode'

# Project-specific config
alias claude-project='flatpak run --env=CLAUDE_CONFIG_DIR=$PWD/.claude com.anthropic.ClaudeCode'

In Flatpak IDEs

From VSCodium or other flatpak IDEs, set the environment variable:

# In your terminal
CLAUDE_CONFIG_DIR=/path/to/project/.claude flatpak run com.anthropic.ClaudeCode

# Or export it for the session
export CLAUDE_CONFIG_DIR=$HOME/.claude-work
flatpak run com.anthropic.ClaudeCode

Additional Use Cases

This flatpak works in:

  • VSCode / VSCodium (flatpak versions)
  • Cursor (when packaged as flatpak)
  • GNOME Builder
  • Other flatpak-based IDEs and terminals

Alternative: flatpak-spawn (Not Recommended)

Note: Using flatpak-spawn to access the host's Claude installation often doesn't work well with IDE terminals due to environment and permission issues. Installing Claude as a flatpak (above) is the recommended approach.

Why flatpak-spawn Has Issues

  • Does not work reliably with some IDE integrated terminals
  • Environment variables and paths may not transfer correctly
  • Technically violates the isolation purpose of flatpak sandboxes
  • Permission issues accessing host resources

If You Still Want to Try flatpak-spawn

Basic usage from within a flatpak sandbox:

flatpak-spawn --host --env=CLAUDE_CONFIG_DIR=$HOME/.claude claude

Requirements:

  • Claude must be installed on the host system
  • The flatpak must have access to org.freedesktop.Flatpak D-Bus interface
  • May need additional permissions in flatpak manifest

For detailed flatpak-spawn documentation, see the flatpak-spawn man page.


Building the Flatpak

See CREATING-FLATPAK.md for complete instructions on:

  • Building the flatpak from source
  • Publishing to GitHub Pages
  • Creating your own flatpak repository
  • Updating to newer versions of Claude Code

What's Included

  • Node.js (LTS version)
  • Claude Code CLI (from npm registry)
  • Sandboxed environment with network access
  • Access to home directory and config files
  • Multi-architecture support (x86_64 and ARM64)

Repository & Support

Official Claude Code Resources

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published