.:'
__ :'__
.'`__`-'__``.
:__________.-'
:_________:
:_________`-; A Swift-powered system info tool
`.__.-.__.' for macOS
A fast, colorful command-line system information display tool written in Swift. Inspired by neofetch, swift_fetch retrieves comprehensive macOS system details and displays them alongside beautiful ASCII art.
- 🎨 Colorized Output - ANSI color-coded labels and values for easy reading
- 🖼️ ASCII Art - Eye-catching Apple logo displayed alongside system info
- 📊 Comprehensive Data - Collects 30 system metrics
- ⚡ Native Swift - Built with Swift for optimal macOS integration
- 🧪 Well Tested - Includes unit tests and property-based tests
Run the tool from your terminal:
swift runOr build a release version:
./bin/build_release.sh
./release/swift-fetchThe tool will display your system information in a formatted layout with ASCII art.
- macOS 12.0 or later
- Swift 5.9 or later
- Xcode Command Line Tools
- Clone the repository:
git clone <repository-url>
cd swift_fetch- Build the project:
swift build- Run the executable:
swift runFor a release build with optimizations, use the build script:
./bin/build_release.shThis will:
- Build the optimized release binary in
.build/release/ - Copy the executable to
release/swift-fetch
Then run it:
./release/swift-fetchOr manually build without the script:
swift build -c release
.build/release/swift-fetchswift_fetch retrieves the following system metrics:
- OS Name - Operating system name (macOS)
- OS Version - Version number (e.g., 14.1)
- OS Build - Build identifier
- Architecture - Processor architecture (arm64/x86_64)
- Host Model - Mac model identifier (e.g., Mac15,11)
- CPU Model - Processor name and specifications
- CPU Cores - Number of physical/logical cores
- GPU Model - Graphics card information
- Memory - Used and total RAM in MiB
- Hostname - Computer name on the network
- Username - Current logged-in user
- Kernel - Kernel version
- Uptime - Time since last boot
- Packages - Homebrew package count
- Resolution - Screen resolution (WIDTHxHEIGHT)
- Desktop Environment - Aqua (macOS standard)
- Window Manager - Quartz Compositor
- WM Theme - Current theme (Light/Dark mode)
- Terminal - Terminal application name
- Terminal Font - Font name and size (if detectable)
- Shell - Shell name and version
- Load Average - System load (1, 5, 15 minute averages)
- Disk Space - Used and free disk space in GiB
- Disk Encryption - FileVault encryption status
- Battery - Battery charge percentage (for portable Macs)
swift_fetch includes a comprehensive test suite with both unit tests and property-based tests.
Run all tests:
swift testRun tests with verbose output:
swift test --verboseUnit Tests (16 tests)
- SystemInfoCollector functionality
- ColorFormatter ANSI code application
- ASCIIArtProvider art generation
- DisplayRenderer alignment logic
- End-to-end integration test
Property-Based Tests (7 properties, 25 iterations each)
Using SwiftCheck, the following correctness properties are verified:
- Comprehensive system information completeness - All fields populated or have fallback values
- Color code application - Valid ANSI escape sequences in colorized output
- Color reset prevents bleeding - Reset codes properly terminate color sequences
- Label and value color distinction - Labels and values use different colors
- Information formatting consistency - Consistent spacing and alignment
- Art and info alignment without overlap - Side-by-side display without character overlap
- Fallback on retrieval errors - Graceful handling of missing data
swift_fetch follows a modular architecture:
- SystemInfoCollector - Retrieves system metrics using macOS APIs and shell commands
- ColorFormatter - Applies ANSI color codes to text
- ASCIIArtProvider - Provides and colorizes ASCII art
- DisplayRenderer - Combines art and info into final output
The tool uses:
ProcessInfofor OS version and basic system infosysctlfor hardware details (CPU, memory, kernel, load averages)unamefor architecture and kernel version- Shell commands for uptime, packages, display info, and disk space
- Environment variables for shell and terminal detection
- CoreGraphics API for screen resolution
fdesetupfor FileVault encryption statuspmsetor IOKit APIs for battery information
[Add your license here]
Contributions are welcome! Please feel free to submit issues or pull requests.
Inspired by neofetch and the system info tool community.