Chuyển tới nội dung
yt-dlp

Cài yt-dlp trên macOS

Cài yt-dlp và ffmpeg trên macOS bằng Homebrew hoặc pipx, và cách cập nhật chúng.

Bài viết này chưa được dịch nên đang hiển thị bằng tiếng Anh. Phần giao diện vẫn theo ngôn ngữ của bạn.

1. Install yt-dlp

Homebrew is the path of least resistance and installs both tools in one line.

brew install yt-dlp ffmpeg

Without Homebrew, pipx keeps yt-dlp in its own environment so it cannot collide with anything else you have installed through Python.

pipx install yt-dlp

Avoid a bare pip install into the system Python: recent macOS releases push back on it, and when it does work it tends to break later for unrelated reasons.

2. Install ffmpeg

Included above if you used Homebrew. Otherwise install it separately — merging, MP3 extraction and embedding all depend on it.

brew install ffmpeg

3. Check it worked

yt-dlp --version
ffmpeg -version

If the shell cannot find yt-dlp after a pipx install, run pipx ensurepath and open a new terminal.

Cookies from Safari

--cookies-from-browser safari needs Full Disk Access for your terminal, granted in System Settings → Privacy & Security. Without it the read fails with a permissions error that does not mention the setting. Chrome and Firefox work without it.

Updating

brew upgrade yt-dlp     # Homebrew
pipx upgrade yt-dlp     # pipx

Câu hỏi thường gặp

macOS không tìm thấy yt-dlp sau khi cài bằng pipx.
Chạy pipx ensurepath, rồi mở một terminal mới để PATH mới được nạp.
Cookies trên macOS có cần thêm gì không?
Chỉ với Safari: --cookies-from-browser safari cần quyền Full Disk Access cho terminal của bạn, trong System Settings → Privacy & Security. Chrome và Firefox thì không cần.
Cập nhật yt-dlp thế nào?
Bản binary độc lập tự cập nhật bằng yt-dlp -U. Nếu cài qua trình quản lý gói thì hãy cập nhật bằng chính trình đó; lệnh tự cập nhật sẽ từ chối sửa một file mà nó không sở hữu. Cập nhật sửa được nhiều lỗi hơn bất kỳ flag nào.