==> Installing dependencies for scrcpy: brotli, giflib, highway, imath, jpeg-turbo, libpng, openexr, 
libtiff, webp, jpeg-xl, libvmaf, aom, dav1d, freetype, fontconfig, frei0r, ca-certificates, gmp, 
bdw-gc, m4, libtool, libunistring, pkg-config, readline, guile, gettext, libidn2, libtasn1, nettle, 
p11-kit, openssl@1.1, libevent, libnghttp2, unbound, gnutls, lame, fribidi, pcre2, glib, libpthread-stubs, xorgproto, libxau, libxdmcp, libxcb, libx11, libxext, libxrender, lzo, pixman, cairo, graphite2, icu4c, 
harfbuzz, libass, libbluray, cjson, cmocka, mbedtls, librist, libsoxr, libvidstab, libogg, libvorbis, 
libvpx, opencore-amr, little-cms2, openjpeg, opus, rav1e, flac, libsndfile, libsamplerate, rubberband, 
sdl2, snappy, speex, srt, leptonica, libb2, lz4, xz, zstd, libarchive, tesseract, theora, x264, x265, 
xvid, libsodium, zeromq, zimg, ffmpeg and libusb
==> Installing scrcpy dependency: brotli
fatal: not in a git directory
Error: Command failed with exit 128: git

解决办法

1. 命令行输入 brew -v
leekey@MacBook-Air-wdw ~ % brew -v
2. 运行得到 fatal 提示
Homebrew 3.6.7
fatal: detected dubious ownership in repository at '/opt/homebrew/Library/Taps/homebrew/homebrew-core'
To add an exception for this directory, call:

	git config --global --add safe.directory /opt/homebrew/Library/Taps/homebrew/homebrew-core
Homebrew/homebrew-core (no Git repository)
fatal: detected dubious ownership in repository at '/opt/homebrew/Library/Taps/homebrew/homebrew-cask'
To add an exception for this directory, call:

	git config --global --add safe.directory /opt/homebrew/Library/Taps/homebrew/homebrew-cask
Homebrew/homebrew-cask (no Git repository)
3. 复制上面两行并运行
git config --global --add safe.directory /opt/homebrew/Library/Taps/homebrew/homebrew-core
git config --global --add safe.directory /opt/homebrew/Library/Taps/homebrew/homebrew-cask
4. 再次用 brew 安装 scrcpy
brew install scrcpy

会发现安装成功!

==> Installing scrcpy dependency: brotli
==> Pouring brotli-1.0.9.arm64_monterey.bottle.tar.gz
🍺  /opt/homebrew/Cellar/brotli/1.0.9: 25 files, 2.3MB
==> Installing scrcpy dependency: giflib
==> Pouring giflib-5.2.1.arm64_monterey.bottle.tar.gz
🍺  /opt/homebrew/Cellar/giflib/5.2.1: 19 files, 540.5KB
==> Installing scrcpy dependency: highway
==> Pouring highway-1.0.1.arm64_monterey.bottle.1.tar.gz

......

==> Installing scrcpy
==> Pouring scrcpy-1.24.arm64_monterey.bottle.1.tar.gz
==> Caveats
At runtime, adb must be accessible from your PATH.

You can install adb from Homebrew Cask:
  brew install --cask android-platform-tools

zsh completions have been installed to:
  /opt/homebrew/share/zsh/site-functions
==> Summary
🍺  /opt/homebrew/Cellar/scrcpy/1.24: 10 files, 315.5KB
==> Running `brew cleanup scrcpy`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
==> Caveats
==> scrcpy
At runtime, adb must be accessible from your PATH.

You can install adb from Homebrew Cask:
  brew install --cask android-platform-tools

zsh completions have been installed to:
  /opt/homebrew/share/zsh/site-functions
5. 接下来可继续安装 adb
brew install --cask android-platform-tools
6. 手机连接电脑,运行scrcpy 即可看到相关信息
scrcpy 1.24 <https://github.com/Genymobile/scrcpy>
/opt/homebrew/Cellar/scrcpy/1.24/share/scrcpy/scrcpy-se...le pushed, 0 skipped. 58.0 MB/s (41159 bytes in 0.001s)
[server] INFO: Device: Xiaomi M2104K10AC (Android 12)
Logo

瓜分20万奖金 获得内推名额 丰厚实物奖励 易参与易上手

更多推荐