Installing/Uninstalling Homebrew on Mac OS - CarlZeng
Background
Introduction: https://brew.sh/index_zh-cn
Manager for missing software packages on macOS (or Linux)
What can Homebrew do? Use Homebrew to install things Apple (or your Linux system) didn’t provide but you need.
Homebrew installs packages to their own directory and then symlinks their files into /opt/homebrew. Homebrew will not install files outside its prefix, so you can install it wherever you like.
Homebrew is a tool that keeps macOS (or your Linux system) software more organized. Use gem to install RubyGems, and brew to install the things that depend on them.
“Drink up” to Homebrew, that is - never touch “ /Applications “ again. Use Homebrew Cask to install command-line or desktop apps.
Documentation
https://github.com/homebrew/install#uninstall-homebrew
A document for usage: https://docs.brew.sh/Manpage#environment
Resolving MAC Installation Errors
/bin/bash -c “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)”
Error #1:
curl: (35) error:1400410B:SSL routines:CONNECT_CR_SRVR_HELLO:wrong version number
curl: (35) LibreSSL SSL_connect: Connection reset by peer in connection to raw.githubusercontent.com:443
Solution:
export https_proxy=http://127.0.0.1:7890 http_proxy=http://127.0.0.1:7890 all_proxy=socks5://127.0.0.1:7890
Error #2:
brew -version
zsh: command not found: brew
Solution:
==> Next steps: - Run these two commands in your terminal to add Homebrew to your PATH:
(echo; echo ‘eval “(/���/ℎ�������/���/�����ℎ������)”′)>>/�����/����/.������������”(/o**pt/homebrew/bin/brewshellen**v)”′)>>/U**sers/car**l/.zprofileeva**l“(/opt/homebrew/bin/brew shellenv)”** - Run brew help to get started - Further documentation:
https://docs.brew.sh
Installation Command
brew install @@
For example: brew install gawk
Installation Log
==> This script will install: /opt/homebrew/bin/brew /opt/homebrew/share/doc/homebrew /opt/homebrew/share/man/man1/brew.1
/opt/homebrew/share/zsh/site-functions/_brew /opt/homebrew/etc/bash_completion.d/brew /opt/homebrew ==> The following new directories will be created: /opt/homebrew/bin /opt/homebrew/etc /opt/homebrew/include /opt/homebrew/lib /opt/homebrew/sbin /opt/homebrew/share /opt/homebrew/var /opt/homebrew/opt /opt/homebrew/share/zsh /opt/homebrew/share/zsh/site-functions /opt/homebrew/var/homebrew /opt/homebrew/var/homebrew/linked /opt/homebrew/Cellar /opt/homebrew/Caskroom /opt/homebrew/Frameworks
Press RETURN/ENTER to continue or any other key to abort:
==> /usr/bin/sudo /usr/bin/install -d -o root -g wheel -m 0755 /opt/homebrew ==> /usr/bin/sudo /bin/mkdir -p /opt/homebrew/bin /opt/homebrew/etc /opt/homebrew/include /opt/homebrew/lib /opt/homebrew/sbin /opt/homebrew/share /opt/homebrew/var /opt/homebrew/opt /opt/homebrew/share/zsh /opt/homebrew/share/zsh/site-functions /opt/homebrew/var/homebrew /opt/homebrew/var/homebrew/linked /opt/homebrew/Cellar /opt/homebrew/Caskroom /opt/homebrew/Frameworks
==> /usr/bin/sudo /bin/chmod ug=rwx /opt/homebrew/bin /opt/homebrew/etc /opt/homebrew/include /opt/homebrew/lib /opt/homebrew/sbin /opt/homebrew/share /opt/homebrew/var /opt/homebrew/opt /opt/homebrew/share/zsh /opt/homebrew/share/zsh/site-functions /opt/homebrew/var/homebrew /opt/homebrew/var/homebrew/linked /opt/homebrew/Cellar /opt/homebrew/Caskroom /opt/homebrew/Frameworks ==> /usr/bin/sudo /bin/chmod go-w /opt/homebrew/share/zsh /opt/homebrew/share/zsh/site-functions ==> /usr/bin/sudo /usr/sbin/chown carl /opt/homebrew/bin /opt/homebrew/etc /opt/homebrew/include /opt/homebrew/lib /opt/homebrew/sbin /opt/homebrew/share /opt/homebrew/var /opt/homebrew/opt /opt/homebrew/share/zsh /opt/homebrew/share/zsh/site-functions /opt/homebrew/var/homebrew /opt/homebrew/var/homebrew/linked /opt/homebrew/Cellar /opt/homebrew/Caskroom /opt/homebrew/Frameworks
==> /usr/bin/sudo /usr/bin/chgrp admin /opt/homebrew/bin /opt/homebrew/etc /opt/homebrew/include /opt/homebrew/lib /opt/homebrew/sbin /opt/homebrew/share /opt/homebrew/var /opt/homebrew/opt /opt/homebrew/share/zsh /opt/homebrew/share/zsh/site-functions /opt/homebrew/var/homebrew /opt/homebrew/var/homebrew/linked /opt/homebrew/Cellar /opt/homebrew/Caskroom /opt/homebrew/Frameworks
==> /usr/bin/sudo /usr/sbin/chown -R carl:admin /opt/homebrew ==> /usr/bin/sudo /bin/mkdir -p /Users/carl/Library/Caches/Homebrew ==> /usr/bin/sudo /bin/chmod g+rwx /Users/carl/Library/Caches/Homebrew ==> /usr/bin/sudo /usr/sbin/chown -R carl /Users/carl/Library/Caches/Homebrew
==> Downloading and installing Homebrew…
remote: Enumerating objects: 235213, done.
remote: Counting objects: 100% (129/129), done.
remote: Compressing objects: 100% (111/111), done.
remote: Total 235213 (delta 26), reused 97 (delta 12), pack-reused 235084 Receiving objects: 100% (235213/235213), 68.34 MiB | 9.51 MiB/s, done.
Resolving deltas: 100% (172493/172493), done.
From https://github.com/Homebrew/brew
- [new branch] dependabot/bundler/Library/Homebrew/addressable-2.8.2 -> origin/dependabot/bundler/Library/Homebrew/addressable-2.8.2
- [new branch] dependabot/bundler/Library/Homebrew/parser-3.2.2.0 -> origin/dependabot/bundler/Library/Homebrew/parser-3.2.2.0
- [new branch] dependabot/bundler/Library/Homebrew/rubocop-1.49.0 -> origin/dependabot/bundler/Library/Homebrew/rubocop-1.49.0
- [new branch] master -> origin/master
- [new branch] test-runners -> origin/test-runners
- [new tag] 0.1 -> 0.1
- [new tag] 0.2 -> 0.2
- [new tag] 0.3 -> 0.3
- [new tag] 4.0.6 -> 4.0.6
- [new tag] 4.0.7 -> 4.0.7
- [new tag] 4.0.8 -> 4.0.8
- [new tag] 4.0.9 -> 4.0.9
HEAD is now at 7dbe1b487 Merge pull request #15142 from Homebrew/revert-15112-prof-group
Warning: /opt/homebrew/bin is not in your PATH.
Instructions on how to configure your shell for Homebrew
can be found in the ‘Next steps’ section below. ==> Installation successful!
==> Homebrew has enabled anonymous aggregate formulae and cask analytics.
Read the analytics documentation (and how to opt-out) here:
https://docs.brew.sh/Analytics
No analytics data has been sent yet (nor will any be during this install run). ==> Homebrew is run entirely by unpaid volunteers. Please consider donating:
https://github.com/Homebrew/brew#donations
==> Next steps: - Run these two commands in your terminal to add Homebrew to your PATH:
(echo; echo ‘eval “(/���/ℎ�������/���/�����ℎ������)”′)>>/�����/����/.������������”(/o**pt/homebrew/bin/brewshellen**v)”′)>>/U**sers/car**l/.zprofileeva**l“(/opt/homebrew/bin/brew shellenv)”
- Run brew help to get started - Further documentation:
https://docs.brew.sh
Enhanced Terminal Command With Proxy Solution
Directly add HTTPS proxy information before the command line, for example:
HTTPS_PROXY=”socks5://127.0.0.1:7890” lux “https://www.youtube.com/watch?v=5Dm9XTbnN-M“
See more: How to Use Lux and Youtube-dl to Download Audio and Video from YouTube, Updated in November 2023