Skip to content

Latest commit

 

History

29 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

dutix

Test Release License: MIT

dutix-hero

dutix (Default UTI eXtension handler manager) is a command-line tool for managing default application handlers for file types, UTIs (Uniform Type Identifiers), and URL schemes on macOS.

Features

  • 🎯 Set default applications for file extensions, UTIs, and URL schemes
  • 🔄 Migrate all file associations from one app to another
  • 📋 List and inspect installed applications and their capabilities
  • 🔍 Query current default handlers for any file type or URL scheme
  • 🛡️ Safe operations with preview, confirmation, and dry-run modes
  • 📊 Multiple output formats (table, JSON, YAML)
  • 🚀 Fast native macOS integration

Screenshot

Requirements

  • macOS 12.0 (Monterey) or later
  • Go 1.25 or later (for building from source)

Installation

Homebrew

brew install jackchuka/tap/dutix

From Source

# Go install
go install github.com/jackchuka/dutix/cmd/dutix@latest

# Clone and build
git clone https://github.com/jackchuka/dutix.git
cd dutix
go build -o dutix ./cmd/dutix/

Quick Start

# Set VS Code as default for text files
dutix set "Visual Studio Code" --extensions txt,md,json

# Check what handles .txt files
dutix targets show txt

# Migrate all file associations from one app to another
dutix apps migrate TextEdit "Visual Studio Code"

# List all installed applications
dutix apps list

Usage

Global Flags

Available on all commands:

Flag Short Description
--debug — Enable debug logging
--quiet -q Suppress non-essential output
--output -o Output format: table, json, or yaml

Commands

dutix set <app> [flags]

Set default application for file extensions, UTIs, or URL schemes.

Flags:

  • --extensions - Comma-separated file extensions (e.g., txt,md,json)
  • --utis - Comma-separated UTI identifiers (e.g., public.plain-text)
  • --schemes - Comma-separated URL schemes (e.g., http,https)
  • --dry-run - Preview changes without applying
  • --yes - Skip confirmation prompt

Examples:

# Set default for file extensions
dutix set "Visual Studio Code" --extensions txt,md,json

# Set default for URL schemes
dutix set Safari --schemes http,https

# Preview changes first
dutix set TextEdit --extensions txt --dry-run

# Skip confirmation
dutix set Finder --extensions zip,tar --yes

dutix apps list [flags]

List all installed applications.

Flags:

  • --filter - Filter by name or path (case-insensitive)

Examples:

# List all applications
dutix apps list

# Find specific app
dutix apps list --filter "Visual"

# JSON output
dutix apps list --output json

dutix apps show <app-name>

Show detailed information about an application including supported file types and UTIs.

Examples:

dutix apps show "Visual Studio Code"
dutix apps show Safari --output json

dutix apps migrate <from-app> <to-app> [flags]

Migrate all file type associations from one application to another.

Flags:

  • --dry-run - Preview migration without applying changes
  • --yes - Skip confirmation prompt

Examples:

# Preview migration
dutix apps migrate TextEdit "Visual Studio Code" --dry-run

# Migrate with confirmation
dutix apps migrate TextEdit "Visual Studio Code"

# Auto-migrate without prompts
dutix apps migrate "Old App" "New App" --yes

dutix targets show <target>

Show current default handler for a file extension, UTI, or URL scheme.

The command automatically detects the target type:

  • Extensions: txt, json, pdf
  • UTIs: public.plain-text, public.json
  • Schemes: http, https, mailto

Examples:

# Check file extension
dutix targets show txt

# Check UTI
dutix targets show public.plain-text

# Check URL scheme
dutix targets show http

dutix targets list [pattern]

List file extensions discovered across all installed applications, along with the UTI each extension resolves to and the current default application for that UTI.

An optional pattern filters extensions by case-insensitive substring.

Examples:

# List all discovered extensions
dutix targets list

# Filter by substring
dutix targets list txt

# Machine-readable output
dutix targets list --output json --quiet

dutix version

Display version information including git commit and build date.

dutix version

Common Use Cases

Setting Up a New Code Editor

# Set VS Code as default for common development files
dutix set "Visual Studio Code" --extensions \
  "txt,md,json,yaml,yml,toml,ini,conf,\
  js,ts,jsx,tsx,mjs,\
  py,rb,go,rs,java,c,cpp,h,hpp,\
  html,css,scss,sass"

# Preview first with dry-run
dutix set "VS Code" --extensions txt,md --dry-run

Switching from One App to Another

# Migrate everything from TextEdit to VS Code
dutix apps migrate TextEdit "Visual Studio Code"

# Preview the migration first
dutix apps migrate Safari Chrome --dry-run

Setting Default Web Browser

# Set Safari as default browser
dutix set Safari --schemes http,ftp,ftps

# Set Chrome
dutix set "Google Chrome" --schemes http

Checking Current Defaults

# What opens .txt files?
dutix targets show txt

# What opens HTTP links?
dutix targets show http

# Get JSON output for scripting
dutix targets show txt --output json --quiet

Finding App Capabilities

# See what file types an app supports
dutix apps show "Visual Studio Code"

# Find apps by name
dutix apps list --filter code

# Get machine-readable output
dutix apps show Safari --output json

Output Formats

Table (Default)

Human-readable formatted tables:

dutix apps list

JSON

Machine-parseable JSON output:

dutix apps list --output json
dutix targets show txt --output json | jq '.defaultApp'

YAML

Structured YAML output:

dutix apps show "Visual Studio Code" --output yaml

Development

Project Structure

dutix/
├── cmd/dutix/           # Application entry point
├── internal/
│   ├── cli/            # CLI commands and subcommands
│   ├── domain/         # Business logic (planner, applier)
│   ├── formatter/      # Output formatters (table, JSON, YAML)
│   ├── logger/         # Logging utilities
│   └── macos/          # macOS bridge layer

Build Commands

export CGO_ENABLED=1

# Build
go build -o dutix ./cmd/dutix/

# Test
go test ./...

# Lint
golangci-lint run ./...

# Generate mocks
go generate ./...

How It Works

dutix relies on macos-apphandlers-bridge to interface with macOS AppKit APIs for querying and setting default application handlers.

The tool uses a three-phase approach:

  1. Plan - Resolves targets and queries current defaults
  2. Preview - Shows what will change before applying
  3. Apply - Makes the changes to system defaults

Known Limitations

  • Some system-protected defaults (like http) may require user confirmation in System Settings
  • Changes to certain defaults may not be reflected immediately in all applications
  • Requires running as the logged-in user (not sandboxed)
  • Some system-internal UTIs are automatically filtered out during migration
  • public.html UTI cannot be set programmatically and is automatically skipped
  • Extensions not declared by any installed application resolve to dynamic (dyn.*) UTIs, which cannot be assigned a default handler and are automatically skipped

License

MIT License

Contributing

Contributions welcome! See docs/DEVELOPMENT.md for development guidelines.

Credits

Inspired by:

  • duti - Command-line default handler manager

Built with:

About

Set default apps, migrate file associations, and manage handlers on macOS

Topics

Resources

Stars

33 stars

Watchers

0 watching

Forks

Releases

Used by

Contributors

Languages