A simple yet powerful command-line tool to record system audio on macOS using BlackHole virtual audio driver.
- 📥 Auto-installation of BlackHole (2ch or 16ch) if not already installed
- 🔄 Automatic audio device switching - sets BlackHole as output and restores original when done
- 📁 Organized recordings in a dedicated folder
- 🎚️ High-quality audio capture using SoX
- 🔌 Zero configuration - works out of the box
- 🎮 Simple controls - just press Ctrl+C to stop recording
- macOS 10.10 or later
- Homebrew package manager
-
Clone this repository:
git clone https://github.com/YOUR_USERNAME/blackhole-recorder.git cd blackhole-recorder -
Make the script executable:
chmod +x record.sh
That's it! The script will automatically install any missing dependencies when you run it.
./record.shThis will:
- Install BlackHole 2ch if not already installed
- Switch your audio output to BlackHole
- Start recording to
./recordings/recording_YYYYMMDD_HHMMSS.wav - When you press Ctrl+C, it will stop recording and restore your original audio output
./record.sh myrecording.wavRecords to ./recordings/myrecording.wav
./record.sh myrecording.wav 16Uses BlackHole 16ch instead of the default 2ch version.
The recording process follows these simple steps:
- The script sets BlackHole as your system audio output
- Any audio played on your Mac is routed through BlackHole
- SoX captures the audio from BlackHole and saves it to a file
- When you stop recording, your original audio output is restored
The script automatically installs these dependencies if needed:
- BlackHole - Virtual audio driver
- SoX - Sound processing tool
- SwitchAudioSource - Command-line audio device control
- 🎮 Record gameplay audio
- 🎵 Capture streaming music
- 🎙️ Save audio from video calls
- 🎬 Record audio for screencasts
- 🔊 Capture system sounds
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.
- ExistentialAudio for creating BlackHole
- SoX team for their excellent audio tool
- deweller for SwitchAudioSource
