This comprehensive guide covers all installation methods, system requirements, and platform-specific instructions for Refocus Shell.
- Linux distributions: Ubuntu, Debian, Fedora, Arch, openSUSE, and derivatives
- Shell: Bash 4.0 or later (most modern Linux systems)
- Architecture: x86_64, ARM64 (Raspberry Pi, Apple Silicon via Rosetta)
- sqlite3 - Database engine for storing focus sessions
- notify-send - Desktop notifications (part of libnotify)
- jq - JSON processing for import/export features
- git - For installation from source and version control integration
- cron - For automated nudge notifications (usually pre-installed)
sudo apt-get install sqlite3 libnotify-bin jqsudo pacman -S sqlite libnotify jqsudo dnf install sqlite libnotify jqsudo zypper install sqlite3 libnotify-tools jqsudo apk add sqlite libnotify jqThe interactive installer automatically handles dependencies, configuration, and shell integration.
# Clone the repository
git clone https://github.com/PeGa/refocus-shell
cd refocus-shell
# Or download and extract release
wget https://github.com/PeGa/refocus-shell/archive/main.zip
unzip main.zip
cd refocus-shell-main# Interactive installation
./setup.sh install
# Silent installation (accepts all defaults)
./setup.sh install --silent
# Installation with custom database path
DB_PATH="$HOME/custom/refocus.db" ./setup.sh install# Restart shell or reload configuration
source ~/.bashrc
# Verify installation
focus help
focus statusFor users who prefer manual control over the installation process.
# Check for dependencies
command -v sqlite3 || echo "sqlite3 missing"
command -v notify-send || echo "notify-send missing"
command -v jq || echo "jq missing"
# Install missing dependencies (Ubuntu/Debian example)
sudo apt-get install sqlite3 libnotify-bin jq# Create installation directories
mkdir -p ~/.local/bin
mkdir -p ~/.local/refocus/{commands,lib}# Copy main executables
cp focus ~/.local/bin/
cp focus-nudge ~/.local/bin/
chmod +x ~/.local/bin/focus
chmod +x ~/.local/bin/focus-nudge
# Copy command modules
cp commands/* ~/.local/refocus/commands/
chmod +x ~/.local/refocus/commands/*
# Copy libraries
cp lib/* ~/.local/refocus/lib/
chmod +x ~/.local/refocus/lib/*
# Copy configuration
cp config.sh ~/.local/refocus/# Add to PATH (if not already there)
echo 'export PATH="$PATH:$HOME/.local/bin"' >> ~/.bashrc
# Add function integration
echo 'source ~/.local/refocus/lib/focus-function.sh' >> ~/.bashrc
# Reload shell
source ~/.bashrc# Initialize the database
focus initFor shared systems or enterprise environments.
# Install executables
sudo cp focus /usr/local/bin/
sudo cp focus-nudge /usr/local/bin/
sudo chmod +x /usr/local/bin/focus*
# Install support files
sudo mkdir -p /usr/local/share/refocus
sudo cp -r commands/ /usr/local/share/refocus/
sudo cp -r lib/ /usr/local/share/refocus/
sudo cp config.sh /usr/local/share/refocus/
# Set permissions
sudo chmod -R 755 /usr/local/share/refocus# System-wide configuration
sudo mkdir -p /etc/refocus
sudo cat > /etc/refocus/config.sh << 'EOF'
#!/bin/bash
# System-wide Refocus Shell configuration
# Installation paths
export REFOCUS_SYSTEM_INSTALL=true
export REFOCUS_LIB_DIR="/usr/local/share/refocus/lib"
export REFOCUS_COMMANDS_DIR="/usr/local/share/refocus/commands"
# Default settings
export REFOCUS_NUDGE_INTERVAL=10
export REFOCUS_VERBOSE=false
EOF
sudo chmod 644 /etc/refocus/config.shUsers need to add shell integration:
# Each user adds to their ~/.bashrc
echo 'source /usr/local/share/refocus/lib/focus-function.sh' >> ~/.bashrc
source ~/.bashrc
# Initialize user database
focus init# Update package list
sudo apt-get update
# Install dependencies
sudo apt-get install git sqlite3 libnotify-bin jq
# Install Refocus Shell
git clone https://github.com/PeGa/refocus-shell
cd refocus-shell
./setup.sh install# Once available
sudo snap install refocus-shell# Install dependencies
sudo pacman -S git sqlite libnotify jq
# Install Refocus Shell
git clone https://github.com/PeGa/refocus-shell
cd refocus-shell
./setup.sh install# Using yay
yay -S refocus-shell
# Using paru
paru -S refocus-shell# Install dependencies
sudo dnf install git sqlite libnotify jq
# Install Refocus Shell
git clone https://github.com/PeGa/refocus-shell
cd refocus-shell
./setup.sh install# Once available
sudo dnf install refocus-shell# Install dependencies
sudo zypper install git sqlite3 libnotify-tools jq
# Install Refocus Shell
git clone https://github.com/PeGa/refocus-shell
cd refocus-shell
./setup.sh install# Update system
sudo apt update && sudo apt upgrade
# Install dependencies
sudo apt install git sqlite3 libnotify-bin jq
# Install Refocus Shell
git clone https://github.com/PeGa/refocus-shell
cd refocus-shell
./setup.sh install- Raspberry Pi 3+ recommended for optimal performance
- Database operations may be slower on older models
- Consider using external storage for large datasets
# Ensure WSL2 is being used
wsl --status
# Update WSL
sudo apt update && sudo apt upgrade# Install dependencies
sudo apt install git sqlite3 libnotify-bin jq
# Install Refocus Shell
git clone https://github.com/PeGa/refocus-shell
cd refocus-shell
./setup.sh install- Desktop notifications may not work (depends on WSL configuration)
- Use
focus nudge disableif notifications are problematic - Consider using
focus statusregularly instead of nudges
# Install with custom database path
export REFOCUS_DB="/path/to/custom/refocus.db"
./setup.sh install
# Or set permanently
echo 'export REFOCUS_DB="/path/to/custom/refocus.db"' >> ~/.bashrc# Install to custom directory
export REFOCUS_INSTALL_DIR="$HOME/tools/refocus"
./setup.sh install# Portable installation (for USB drives, etc.)
export REFOCUS_DATA_DIR="/portable/path/refocus"
export REFOCUS_DB="/portable/path/refocus/refocus.db"
./setup.sh install# Clone for development
git clone https://github.com/PeGa/refocus-shell
cd refocus-shell
# Install in development mode (uses source directory)
./setup.sh install --dev
# This creates symlinks instead of copying files
# Changes to source files are immediately active# Fork and clone your fork
git clone https://github.com/PeGa/refocus-shell
cd refocus-shell
# Add upstream remote
git remote add upstream https://github.com/PeGa/refocus-shell
# Install in development mode
./setup.sh install --dev
# Set up git hooks
cp .githooks/* .git/hooks/
chmod +x .git/hooks/*# Test basic commands
focus help
focus init
focus config show
# Test session management
focus on "test-session"
focus status
focus off
# Test history
focus past list 5
# Test exports
focus export test-backup
ls test-backup.*# Test notification system
focus nudge test
# Enable nudges and test
focus nudge enable
focus on "nudge-test"
# Wait for nudge notification
focus off# Test prompt integration
focus on "prompt-test"
echo $PS1 # Should show focus indicator
focus off
echo $PS1 # Should return to normalCommand not found after installation:
# Check if PATH includes installation directory
echo $PATH | grep -o '\.local/bin'
# Reload shell configuration
source ~/.bashrc
# Or restart terminalDatabase initialization fails:
# Check permissions
ls -la ~/.local/refocus/
# Fix permissions
chmod 755 ~/.local/refocus
touch ~/.local/refocus/refocus.db
chmod 644 ~/.local/refocus/refocus.db
# Reinitialize
focus initNotifications not working:
# Test system notifications
notify-send "Test" "This is a test"
# Check desktop environment
echo $XDG_CURRENT_DESKTOP
# Install desktop-specific packages if neededcd refocus-shell
git pull origin main
./setup.sh install # Overwrites existing installation# Always backup before upgrading
focus export upgrade-backup-$(date +%Y%m%d)
# Upgrade
cd refocus-shell
git pull
./setup.sh install
# Verify upgrade
focus status# Export from old version
focus export migration-backup
# Install new version
# ... installation steps ...
# Import data
focus import migration-backup.json# Uninstall Refocus Shell
cd refocus-shell
./setup.sh uninstall
# Remove all data (optional)
rm -rf ~/.local/refocus
rm -rf ~/.config/refocus-shell
# Clean shell configuration
grep -v "refocus" ~/.bashrc > ~/.bashrc.new
mv ~/.bashrc.new ~/.bashrc# Uninstall but keep data
./setup.sh uninstall --keep-data
# Data remains in ~/.local/refocus for future use# Secure installation
chmod 700 ~/.local/refocus # Directory access
chmod 600 ~/.local/refocus/refocus.db # Database file
chmod 755 ~/.local/bin/focus* # Executables- Refocus Shell makes no network connections
- All data stored locally
- No telemetry or data collection
- Safe for secure/isolated environments
- Each user has isolated data
- No shared state between users
- User-specific configuration
- No privilege escalation required
For more information, see Getting Started or Troubleshooting.