macOS
homebrew
网络加速
直接使用代理,简单粗暴!
export all_proxy=socks5://127.0.0.1:1080
brew outdated还可使用国内镜像源:
初始安装清华大学镜像源的hombebrew
安装Command Line Tools (CLT) for Xcode:
xcode-select --installexport HOMEBREW_BREW_GIT_REMOTE="https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git"
export HOMEBREW_CORE_GIT_REMOTE="https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git"
export HOMEBREW_INSTALL_FROM_API=1
export HOMEBREW_API_DOMAIN="https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles/api"
export HOMEBREW_BOTTLE_DOMAIN="https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles"
git clone --depth=1 https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/install.git brew-install
/bin/bash brew-install/install.sh
rm -rf brew-install安装成功后需将brew程序的相关路径加入到环境变量中。
vi ~/.zshrc加入:
export HOMEBREW_API_DOMAIN="https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles/api"
export HOMEBREW_BOTTLE_DOMAIN="https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles"
export PATH=$PATH:/opt/homebrew/bin替换brew自己的源:
export HOMEBREW_CORE_GIT_REMOTE="https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git"
brew tap --custom-remote --force-auto-update homebrew/command-not-found https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-command-not-found.git
brew update另外homebrew中文网提供的安装脚本中内置了国内镜像源。
查看已安装软件包的依赖树
brew deps --tree --installed列出顶级包
列出所有已安装但不是其他已安装包依赖项的包。
brew leaves查看哪些包依赖这个包
brew uses --installed ca-certificates看某包的构建/运行依赖树
brew deps --tree [email protected]proxychains-ng
安装:
brew install proxychains-ng配置:
sudo vi /opt/homebrew/etc/proxychains.conf
# 加入代理配置 ...在不关闭SIP的情况下使用proxychains-ng:
在关于Mac上的系统完整性保护中有介绍,系统完整性保护(SIP)包含对以下系统部分的保护:
/System
/usr
/bin
/sbin
/var
Mac操作系统预装的Appbrew安装的工具位于/opt/homebrew下,不受SIP的影响。
例如对于brew安装的wget:
brew install wget
which wget
/opt/homebrew/bin/wget
proxychains4 wget ifconfig.me
# 可以显示代理服务器的ip
cat index.html 一般使用proxychains4和wget, rclone等工具进行命令行下的文件下载。
Xcode command line tools中带的git位于/usr/bin/git,受系统完整性保护,不能使用proxychains4。
但Git 2.0之后的版本支持socks5协议代理,可以通过在终端设置代理相关的环境变量。
export http_proxy='socks5://127.0.0.1:1080'
export https_proxy='socks5://127.0.0.1:1080'
git clone https://github.com/xxx/yyyDocker + Colima
launchctl
launchctl是macOS系统上管理launchd守护进程的命令行工具,用于控制系统服务和后台任务。
查看所有非系统服务:
launchctl list | grep -v "com.apple"删除服务:
launchctl remove xxx - 用户服务通常位于
~/Library/LaunchAgents - 第三方全局服务通常位于
/Library/LaunchDaemons和/Library/LaunchAgents
clash verge rev
开Tun模式安装的服务如何卸载:
sudo launchctl stop io.github.clash-verge-rev.clash-verge-rev.service
sudo launchctl unload /Library/LaunchDaemons/io.github.clash-verge-rev.clash-verge-rev.service.plist
sudo rm -rf /Library/PrivilegedHelperTools/io.github.clash-verge-rev.clash-verge-rev.service.bundle
mkdir -p ~/Backup
cp /Library/Preferences/SystemConfiguration/NetworkInterfaces.plist ~/Backup
sudo rm -f /Library/Preferences/SystemConfiguration/NetworkInterfaces.plist