macOS
$ ls -latotal 8

macOS #

homebrew #

网络加速 #

直接使用代理,简单粗暴!

1export all_proxy=socks5://127.0.0.1:1080
2
3brew outdated

还可使用国内镜像源:

初始安装清华大学镜像源的hombebrew

安装Command Line Tools (CLT) for Xcode:

1xcode-select --install
 1export HOMEBREW_BREW_GIT_REMOTE="https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git"
 2export HOMEBREW_CORE_GIT_REMOTE="https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git"
 3export HOMEBREW_INSTALL_FROM_API=1
 4
 5export HOMEBREW_API_DOMAIN="https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles/api"
 6export HOMEBREW_BOTTLE_DOMAIN="https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles"
 7
 8git clone --depth=1 https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/install.git brew-install
 9/bin/bash brew-install/install.sh
10rm -rf brew-install

安装成功后需将brew程序的相关路径加入到环境变量中。

1vi ~/.zshrc

加入:

1export HOMEBREW_API_DOMAIN="https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles/api"
2export HOMEBREW_BOTTLE_DOMAIN="https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles"
3export PATH=$PATH:/opt/homebrew/bin

替换brew自己的源:

1export HOMEBREW_CORE_GIT_REMOTE="https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git"
2brew tap --custom-remote --force-auto-update homebrew/command-not-found https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-command-not-found.git
3brew update

另外homebrew中文网提供的安装脚本中内置了国内镜像源。

查看已安装软件包的依赖树 #

1brew deps --tree --installed

proxychains-ng #

安装:

1brew install proxychains-ng

配置:

1sudo vi /opt/homebrew/etc/proxychains.conf
2# 加入代理配置 ...

在不关闭SIP的情况下使用proxychains-ng

关于Mac上的系统完整性保护中有介绍,系统完整性保护(SIP)包含对以下系统部分的保护:

1/System
2/usr
3/bin
4/sbin
5/var
6Mac操作系统预装的App

brew安装的工具位于/opt/homebrew下,不受SIP的影响。

例如对于brew安装的wget:

1brew install wget
2
3which wget
4/opt/homebrew/bin/wget
5
6proxychains4 wget ifconfig.me
7
8# 可以显示代理服务器的ip
9cat index.html 

一般使用proxychains4和wget, rclone等工具进行命令行下的文件下载。

Xcode command line tools中带的git位于/usr/bin/git,受系统完整性保护,不能使用proxychains4。 但Git 2.0之后的版本支持socks5协议代理,可以通过在终端设置代理相关的环境变量。

1export http_proxy='socks5://127.0.0.1:1080'
2export https_proxy='socks5://127.0.0.1:1080'
3
4git clone https://github.com/xxx/yyy

Docker + Colima #

launchctl #

launchctl是macOS系统上管理launchd守护进程的命令行工具,用于控制系统服务和后台任务。

查看所有非系统服务:

1launchctl list | grep -v "com.apple"

删除服务:

1launchctl remove xxx 
  • 用户服务通常位于~/Library/LaunchAgents
  • 第三方全局服务通常位于/Library/LaunchDaemons/Library/LaunchAgents
© 2025 青蛙小白 | 总访问量 | 总访客数