I have installed HomeBrew before, but when I recently executed brew install scrcpy, I got -bash: brew: command not found.
By modifying ~/.zshrc and ~/.zprofile configuration files, add environment variables to them
Edit the ~/.zshrc file and add the following environment variables
#brew config
export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles/bottle
Finally source ~/.zshrc to make the configuration file effective
Then edit the ~/.zprofile file and add the following environment variables
#brew config
export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles/bottles
Finally source ~/.zshrc to make the configuration file effective
Now to verify, enter brew -v
The problem of -bash: brew: command not found is no longer reported.
Now start installing scrcpy
Follow the prompts given to install: arch -arm64 brew install scrcpy
Still getting an error during installation
The solution is to reinstall Homeblew
Use the following address to install in the country:
-
(Completely recommended) General installation script:
-
/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"
The installation is successful but you still need to restart the terminal or run source /Users/liqinzhang/.bash_profile otherwise the domestic address will not take effect.
Then install brew install scrcpy
Error reported:
==> Installing scrcpy dependency: brotli
fatal: not in a git directory
Error: Command failed with exit 128: git
Solution:
Brew -v will show two prompts, prompting the user to homebrew-cask
set homebrew-core
the file path to safe.directory.
Use the following command to solve it:
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
Then brew install scrcpy and the installation will be successful.
If you have an adb environment, you can use scrcpy to record the screen on your mobile phone.