| Crates.io | port-conflict-resolver |
| lib.rs | port-conflict-resolver |
| version | 0.1.0 |
| created_at | 2025-10-14 00:07:12.413907+00 |
| updated_at | 2025-10-14 00:07:12.413907+00 |
| description | A cross-platform CLI utility to identify and resolve port conflicts by detecting and terminating processes |
| homepage | https://github.com/am-miracle/port-conflict-resolver |
| repository | https://github.com/am-miracle/port-conflict-resolver |
| max_upload_size | |
| id | 1881346 |
| size | 149,788 |
A cross-platform CLI utility that helps developers quickly identify and resolve port conflicts. Given a port number, it detects which process is using it and offers a single command to terminate that process across Linux, macOS, and Windows.
git clone https://github.com/am-miracle/port-conflict-resolver.git
cd port-conflict-resolver
cargo build --release
The binary will be at target/release/port-conflict-resolver.
# Linux/macOS
sudo cp target/release/port-conflict-resolver /usr/local/bin/pcr
# Or add to PATH in your shell profile
export PATH="$PATH:/path/to/port-conflict-resolver/target/release"
pcr check 8080
Output:
✓ Port 8080 is in use
PID: 12345
Process: node
Command: node server.js
# Graceful kill (SIGTERM)
pcr kill 8080
# Force kill (SIGKILL)
pcr kill 8080 --force
pcr list
Output:
PORT PID PROCESS COMMAND
3000 1234 node node server.js
8080 5678 python3 python3 -m http.server
pcr info 8080
pcr interactive
Commands in interactive mode:
1-9: Toggle port selectiona or all: Select all portsn or none: Deselect allk or kill: Kill selected portsq or quit: Exitpcr update
pcr version
Config file location: ~/.config/pcr/config.toml
Example configuration:
# Ports that will be killed without confirmation
auto_kill_ports = [3000, 8080]
# Ports to ignore in listings (system ports)
ignored_ports = [22, 80, 443]
# Wait time before force kill (milliseconds)
grace_period_ms = 2000
# Run all tests (unit + integration)
cargo test
# Unit tests only
cargo test --bin port-conflict-resolver
# Integration tests only
cargo test --test test
# Specific test
cargo test test_cli_version
# With output
cargo test -- --nocapture
port-conflict-resolver/
├── src/
│ ├── main.rs # Entry point & command handlers
│ ├── cli.rs # CLI argument definitions
│ ├── finder.rs # Cross-platform process detection
│ ├── killer.rs # Process termination logic
│ ├── utils.rs # Output formatting & errors
│ └── enhancements/
│ ├── config.rs # Configuration management
│ ├── interactive.rs # Interactive TUI mode
│ └── updater.rs # Version checking
├── tests/
│ └── test.rs # Integration tests
├── Cargo.toml
├── README.md
└── TESTING.md # Testing guide
cargo run -- check 8080
cargo run -- list
cargo run -- --help
cargo build --release
lsof and ss for process detectionkill with SIGTERM/SIGKILLlsof for process detectionkill with SIGTERM/SIGKILLnetstat for process detectiontaskkill with /T (graceful) or /F (force)lsof, ss, killlsof, kill (pre-installed)netstat, taskkill (pre-installed)clap - CLI argument parsingsysinfo - System & process informationcolored - Terminal colorsanyhow - Error handlingtokio - Async runtimeserde + toml - Configuration serializationindicatif - Progress indicatorsreqwest - HTTP client for updatesSee Cargo.toml for complete dependency list.
git checkout -b feature-namecargo testgit commit -am 'Add feature'git push origin feature-nameIf you get permission errors when killing processes:
# Linux/macOS - may need sudo for system processes
sudo pcr kill 80
# Windows - run as Administrator
Linux:
sudo apt-get install net-tools iproute2 lsof
macOS: Tools are pre-installed. If missing:
xcode-select --install
Windows: Tools are pre-installed with Windows.
Try force kill:
pcr kill 8080 --force
Or increase grace period in config:
grace_period_ms = 5000
| Platform | Tested | Status |
|---|---|---|
| macOS | ✅ Yes | PASS |
| Linux | ⚠️ Conditional compilation | Untested |
| Windows | ⚠️ Conditional compilation | Untested |
Note: Tests run on macOS. Cross-platform code uses conditional compilation (#[cfg(target_os = "...")]).
Made with ❤️ for developers tired of port conflicts