Guides / Recording internal and system audio
How to record Mac system audio from the Terminal
Tested on macOS 26.4.1 (Tahoe), Apple M3 Max, 3 Sept 2026. Updated 2026-09-03.
No Terminal tool on macOS records system audio by itself. ffmpeg -f avfoundation, SoX rec and screencapture -g all read Core Audio input devices, and the Mac's output is not one. On the test Mac, ffmpeg 8.1.1 listed four audio devices, all inputs. To capture system output from the command line you route it into a virtual device such as BlackHole first, then record that device.
Can ffmpeg record system audio on a Mac?
Not directly. ffmpeg's macOS capture input is avfoundation, which the ffmpeg documentation describes as "the currently recommended framework by Apple for streamgrabbing on OSX". AVFoundation enumerates capture devices. Run the listing command on macOS 26.4.1 with ffmpeg 8.1.1:
ffmpeg -f avfoundation -list_devices true -i ""
Output on the test Mac, audio section: [0] Serato Virtual Audio, [1] iPhone Microphone, [2] MacBook Pro Microphone, [3] Microsoft Teams Audio. Video section: FaceTime HD Camera, two iPhone cameras, and Capture screen 0. There is no "system output" or "speakers" entry, and Capture screen 0 carries video only. Two of the four audio entries are virtual devices installed by Serato and Teams, which is the clue: the only way anything the Mac plays reaches ffmpeg is through a virtual device that presents output as input.
ScreenCaptureKit, the API that does capture system audio on macOS 13 or newer, has no ffmpeg input device. See what ScreenCaptureKit audio capture is.
Which Terminal commands work for recording audio inputs?
All three tools are fine for microphones and audio interfaces. Replace the index with the one from your device listing.
- ffmpeg, 24-bit WAV at 48 kHz from audio device 2:
ffmpeg -f avfoundation -i ":2" -ar 48000 -c:a pcm_s24le take.wav. The colon means "no video device". Use-audio_device_index 2instead of the index in the filename if you prefer. - SoX:
rec take.wav. The SoX manual says that when invoked asrec, "the default sound device is used as an input source", and theAUDIODEVenvironment variable overrides that device. SoX is not installed on macOS; it comes from Homebrew. - screencapture (built in):
screencapture -v -g take.mov. The man page on macOS 26.4.1 documents-gas "Captures audio during a video recording using default input" and-G <id>for a specific input. Again an input, and the result is a video file.
Device indexes shift when devices come and go, so a script that ran yesterday can record the wrong device today. ffmpeg's -audio_device_id accepts a stable uid: or serial: identifier for that reason.
How do you route system audio into ffmpeg with BlackHole?
Install a virtual device, send the Mac's output to it, record it as an input.
- Install BlackHole 2ch (free, GPL-3.0) from its GitHub releases.
- Open Audio MIDI Setup, click +, Create Multi-Output Device, tick your speakers and BlackHole 2ch. Right-click it and choose Use This Device For Sound Output. Without this step your Mac goes silent while you record.
- List devices again and note BlackHole's audio index, then:
ffmpeg -f avfoundation -i ":<index>" -ar 48000 -c:a pcm_s24le system.wav. - Press q in the Terminal to stop.
Two failure modes. First, the recording is silent because the Multi-Output Device is not the active output, or because BlackHole runs at a different sample rate from the speakers; set every device in the Multi-Output to 48 kHz. Second, the index changed after a headset or interface was plugged in; re-list before every session. The full driver setup lives in how to create a Multi-Output Device, and removing it afterwards in uninstalling BlackHole.
When is the Terminal the wrong tool for this?
For long or unattended takes. ffmpeg records from a fixed device for as long as that device exists and the process runs; there is no watchdog, no reconnect logic, and no notion of a device that vanished and came back under a new Core Audio ID. If a USB interface drops out at hour two of a DJ set, the take ends there. A GUI recorder with reconnection handles this: AirCheck checks for buffers every 2 seconds, restarts capture into the same file after 5 seconds of silence, and re-resolves a replugged device by name.
The Terminal is the right tool for scripted, short captures of a known input, for batch conversion (ffmpeg and afconvert, which ships with macOS, both handle WAV, AIFF and MP3 conversions) and for headless Macs. It is the wrong tool for "record whatever plays for the next three hours", and it cannot get at system audio without installing a driver.
AVFoundation is the currently recommended framework by Apple for streamgrabbing on OSX >= 10.7 as well as on iOS.
FFmpeg documentation, ffmpeg-devices (avfoundation)
Command-line audio capture on macOS 26.4.1 (Sept 2026)
| Tool | Records inputs | Records system output alone | With BlackHole | Output | Ships with macOS |
|---|---|---|---|---|---|
| ffmpeg -f avfoundation | yes | no | yes | WAV, AIFF, MP3, any | no (Homebrew) |
| sox / rec | yes | no | yes | WAV, AIFF, others | no (Homebrew) |
| screencapture -v -g | yes | no | yes | MOV video | yes |
| AirCheck (GUI) | yes | yes (ScreenCaptureKit) | not needed | WAV, MP3 | no ($39) |
Device listing on the test Mac showed only input and virtual devices, no system output entry.
Where AirCheck fits
AirCheck is the GUI answer to the problem this page shows: it captures system output through ScreenCaptureKit with no driver, no Multi-Output Device and no index that shifts, and it exports WAV or MP3 into ~/Music/AirCheck. It requires macOS 14 or newer and costs $39 once. For interface recording it adds what ffmpeg lacks on long takes, a watchdog that restarts capture into the same file and re-resolves a replugged device by name.
When you do not need it: If you are scripting a short capture from a known microphone or interface, ffmpeg or rec is free and scriptable and AirCheck adds nothing. If you need cron-driven, headless capture, stay in the Terminal.
AirCheck records what your Mac plays, or any input, to one file. $39 once.
macOS 14 or newer. One-off payment. Fourteen-day refund, no questions asked.
Questions people ask
Does ffmpeg's avfoundation input see ScreenCaptureKit audio?
No. ffmpeg has no ScreenCaptureKit audio input device. Its avfoundation input lists AVFoundation capture devices, which on the test Mac were two microphones and two virtual devices installed by Serato and Teams, and nothing representing system output.
Can screencapture record system audio from the command line?
No. The macOS 26.4.1 man page documents -g as capturing audio "using default input" during a video recording. It records a microphone into a MOV file, not the Mac's output.
What sample rate should I pass to ffmpeg for a Mac recording?
Match the device: 48 kHz for most interfaces and for anything routed through BlackHole set to 48 kHz. Add -ar 48000 and -c:a pcm_s24le for a 24-bit WAV that matches what ScreenCaptureKit recorders produce.
Is there a built-in command-line audio recorder on macOS?
Only screencapture, which records video plus an input device. macOS ships afplay, afconvert and afinfo for playback, conversion and inspection, but no afrecord. For audio-only capture from the Terminal you install ffmpeg or SoX through Homebrew.
Sources
- FFmpeg: ffmpeg-devices documentation (avfoundation)
- SoX manual (rec, -d, AUDIODEV)
- Existential Audio: BlackHole on GitHub
- Apple: ScreenCaptureKit capturesAudio
Related guides
- What is ScreenCaptureKit audio capture on a Mac?
- How to create a Multi-Output Device on a Mac (and keep hearing your audio)
- Can Audacity record system audio on a Mac?
- How to convert AIFF or WAV to MP3 on a Mac
- Can a Mac record internal audio natively?
- How to record audio from a browser tab on a Mac
- Recording internal and system audio: all guides
- Every guide, by topic