Skip to content

Instantly share code, notes, and snippets.

@himanshuain
Created March 4, 2026 18:05
Show Gist options
  • Select an option

  • Save himanshuain/22c5ff4de7cea337d805f2fdca5b5480 to your computer and use it in GitHub Desktop.

Select an option

Save himanshuain/22c5ff4de7cea337d805f2fdca5b5480 to your computer and use it in GitHub Desktop.
Listen to your MacBook audio on your iPhone - Free, No App, WiFi streaming guide

Listen to Your MacBook Audio on Your iPhone (Free, No App)

Ever wanted to walk away from your desk but keep listening to that podcast, meeting, or playlist playing on your Mac? Here's how to stream your MacBook's audio to your iPhone over WiFi — no paid apps, no iPhone app install. Just Safari.

What you'll get: Your Mac's audio playing on your iPhone through AirPods/earphones. Walk around the house, go to the kitchen, lie on your bed — keep listening.

Time to set up: ~10 minutes (one time). After that, it's a one-command start.


How It Works (Simple Version)

Mac Audio → BlackHole (virtual cable) → ffmpeg (streams over WiFi) → iPhone Safari

BlackHole is a free virtual audio driver that captures your Mac's sound. ffmpeg converts it to an MP3 stream on your local network. Your iPhone opens that stream in Safari like a radio station.


One-Time Setup

Step 1: Install the tools

Open Terminal on your Mac (Cmd + Space → type "Terminal") and run these two commands:

brew install ffmpeg
brew install --cask blackhole-2ch

The second command will ask for your Mac password. Type it (you won't see characters — that's normal) and press Enter.

Don't have Homebrew? Install it first with:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Step 2: Reboot your Mac

BlackHole installs a system audio driver. You need to restart for it to show up.

Step 3: Create a Multi-Output Device

This step makes your Mac play audio through your speakers AND BlackHole at the same time (so you can hear it locally while also streaming).

  1. Open Audio MIDI Setup (Cmd + Space → type "Audio MIDI Setup")
  2. Click the + button at the bottom-left
  3. Select Create Multi-Output Device
  4. In the right panel, check both:
    • ✅ Your main speakers (e.g., "MacBook Pro Speakers" or "External Headphones")
    • BlackHole 2ch
  5. Right-click the new "Multi-Output Device" in the left sidebar → Use This Device For Sound Output

That's it for setup. You only do this once.

Tip: If you want to go back to normal audio later, just go to System Settings → Sound → Output and pick your regular speakers.


The Streaming Script

Save this script somewhere handy (like your Desktop). It does everything automatically — finds your IP, finds BlackHole, starts the stream, and tells you the URL.

Create the script:

Open Terminal and run:

cat << 'EOF' > ~/Desktop/stream-to-iphone.sh
#!/bin/bash

RED='\033[0;31m'; GREEN='\033[0;32m'
YELLOW='\033[1;33m'; CYAN='\033[0;36m'
BOLD='\033[1m'; NC='\033[0m'

echo ""
echo -e "${CYAN}${BOLD}🎧 Mac Audio → iPhone${NC}"
echo ""

# Check BlackHole
if ! ls /Library/Audio/Plug-Ins/HAL/ 2>/dev/null | grep -qi "blackhole"; then
    echo -e "${RED}BlackHole not found. Install it:${NC}"
    echo "  brew install --cask blackhole-2ch"
    echo "  Then reboot."
    exit 1
fi

# Check ffmpeg
if ! command -v ffmpeg &>/dev/null; then
    echo -e "${RED}ffmpeg not found. Install it:${NC}"
    echo "  brew install ffmpeg"
    exit 1
fi

# Get local IP
IP=$(ipconfig getifaddr en0 2>/dev/null || ipconfig getifaddr en1 2>/dev/null || echo "")
if [ -z "$IP" ]; then
    echo -e "${RED}Not on WiFi. Connect to the same network as your iPhone.${NC}"
    exit 1
fi

PORT=8888

# Find BlackHole device
DEVS=$(ffmpeg -f avfoundation -list_devices true -i "" 2>&1 || true)
BH=$(echo "$DEVS" | grep -i "blackhole" | head -1 | sed -n 's/.*\[\([0-9]*\)\].*/\1/p')

if [ -z "$BH" ]; then
    echo -e "${RED}BlackHole audio device not found. Reboot after installing.${NC}"
    exit 1
fi

# Kill old stream if any
pkill -f "ffmpeg.*listen 1" 2>/dev/null; sleep 1

echo -e "${GREEN}${BOLD}Stream ready!${NC}"
echo ""
echo -e "  Open this URL on your ${BOLD}iPhone Safari${NC}:"
echo ""
echo -e "     ${BOLD}${GREEN}http://${IP}:${PORT}/stream.mp3${NC}"
echo ""
echo -e "  ${CYAN}• iPhone must be on the same WiFi as your Mac${NC}"
echo -e "  ${CYAN}• Connect AirPods/earphones to your iPhone${NC}"
echo -e "  ${CYAN}• ~1-2 second delay (fine for music/podcasts)${NC}"
echo ""
echo -e "  ${YELLOW}Press Ctrl+C to stop.${NC}"
echo ""

ffmpeg -f avfoundation -i ":${BH}" \
    -acodec libmp3lame -ab 192k -ar 44100 -ac 2 \
    -content_type audio/mpeg \
    -f mp3 -listen 1 \
    "http://0.0.0.0:${PORT}/stream.mp3" 2>/dev/null
EOF
chmod +x ~/Desktop/stream-to-iphone.sh
echo "✅ Script saved to ~/Desktop/stream-to-iphone.sh"

Run it:

~/Desktop/stream-to-iphone.sh

It will print something like:

🎧 Mac Audio → iPhone

Stream ready!

  Open this URL on your iPhone Safari:

     http://192.168.1.42:8888/stream.mp3

  • iPhone must be on the same WiFi as your Mac
  • Connect AirPods/earphones to your iPhone
  • ~1-2 second delay (fine for music/podcasts)

  Press Ctrl+C to stop.

Open that URL on your iPhone in Safari. Done. You're streaming.


Usage Summary

After the one-time setup, your daily workflow is:

  1. Make sure "Multi-Output Device" is your sound output (check in menu bar or System Settings → Sound)
  2. Run ~/Desktop/stream-to-iphone.sh in Terminal
  3. Open the URL it gives you in iPhone Safari
  4. Listen with your AirPods/earphones on iPhone
  5. Ctrl+C in Terminal when done

FAQ

Q: Can I use this for video calls / meetings? A: Yes, but there's a 1-2 second audio delay. Fine for listening in, not for actively participating.

Q: Does it work with AirPods connected to iPhone? A: Yes. Connect AirPods to your iPhone (not Mac), then open the stream URL.

Q: What about Bluetooth range? A: This uses WiFi, not Bluetooth. As long as your iPhone has WiFi signal, you can be anywhere in your house.

Q: Can multiple iPhones listen? A: The basic setup supports one listener. For multiple, you'd need a different streaming approach.

Q: How do I go back to normal audio? A: System Settings → Sound → Output → select your regular speakers instead of Multi-Output Device.

Q: Does this work on Intel Macs? A: Yes. BlackHole and ffmpeg both support Intel and Apple Silicon.


What's Installed

Tool What it does Size Install
BlackHole 2ch Virtual audio cable (captures system sound) Tiny (~1MB) brew install --cask blackhole-2ch
ffmpeg Converts & streams audio over HTTP ~53MB brew install ffmpeg

Both are free, open-source, and widely trusted.


That's it. Your Mac is now a radio station and your iPhone is the receiver. Enjoy walking around while staying plugged in.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment