A command-line tool for controlling system audio volume on macOS, written in Swift.
- Reset volumes to default values (output: 56%, input: 50%)
- Set custom volume levels for both output and input
- Control output or input volume independently
- Works without requiring sudo or special permissions
- Clone or download this repository
- Compile the tool:
make
Reset output volume to 56% and input volume to 50%:
./volume_controller reset
Set both output and input volumes:
./volume_controller set <output> <input>
# Example: Set output to 70% and input to 60%
./volume_controller set 70 60
./volume_controller output <value>
# Example: Set output to 80%
./volume_controller output 80
./volume_controller input <value>
# Example: Set input to 40%
./volume_controller input 40
./volume_controller help
- Output Volume: Uses Core Audio API for precise control
- Input Volume: Uses AppleScript for reliable control across macOS versions
- Input Volume Rounding: macOS rounds input volume to specific increments (e.g., 50% may become 53%)
volume_controller.swift
- Main source codevolume_controller
- Compiled executableset_input_volume.swift
- Original input-only versionMakefile
- Build configuration
- macOS
- Swift compiler (comes with Xcode or Command Line Tools)
# Using make
make
# Or compile directly
swiftc volume_controller.swift -o volume_controller
# Clean build files
make clean
This project is provided as-is for personal use.