MacOS 环境配置

软件

  • VPN
  • Chrome
  • 豆包 / Ollama
  • Word / Excel / PowerPoint(App Store 下载的需要激活)
  • Adobe Acrobat / PDFgear
  • 微信 / 飞书
  • 腾讯会议
  • 百度网盘 / 阿里云盘
  • VS Code
  • Zotero(配置
  • Spotify
  • Snipaste
  • Logi Options+(使用罗技设备需要)

VPN

cd
echo 'export http_proxy="http://127.0.0.1:7890"' >> .zprofile
echo 'export https_proxy="http://127.0.0.1:7890"' >> .zprofile
echo 'export all_proxy="socks5://127.0.0.1:7890"' >> .zprofile
echo "export GIT_SSH_COMMAND=\"ssh -o ProxyCommand='nc -x 127.0.0.1:7890 %h %p'\"" >> .zprofile

Homebrew

参考 https://mirrors.tuna.tsinghua.edu.cn/help/homebrew/ 安装 Homebrew 。

cd
echo 'export HOMEBREW_API_DOMAIN="https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles/api"' >> .zprofile
echo 'export HOMEBREW_BOTTLE_DOMAIN="https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles"' >> .zprofile
echo 'export HOMEBREW_PIP_INDEX_URL="https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple"' >> .zprofile
echo 'export HOMEBREW_BREW_GIT_REMOTE="https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git"' >> .zprofile
source .zprofile

bash -c "$(curl -fsSL https://github.com/Homebrew/install/raw/master/install.sh)"

echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> .zprofile
source .zprofile

通过 Homebrew 安装 wget 、 tmux 等软件。

brew install wget
brew install openssh  # 解决 sftp 不能用 tab 补全的 bug
brew install tmux

oh-my-zsh、oh-my-tmux、awesome-vimrc 的配置方法可以参考 Ubuntu 新用户创建与环境配置(oh-my-zsh / oh-my-tmux / awesome-vimrc)

其他 Mac 上常用的命令行工具

brew install 7zip
brew install rar

Git

brew install git-lfs

Python

brew install pipx
pipx ensurepath

关闭当前终端,重启终端使路径修改生效。继续配置 pipx

pipx install argcomplete
autoload -U compinit && compinit
eval "$(register-python-argcomplete pipx)"

安装所需命令

pipx install pipenv

Docker

安装 Docker Desktop

在【Settings - General - Configure shell completions - Automatically (edits your shell configuration)】点击【Install】。

阿里云 容器镜像服务中,选择【镜像工具 - 镜像加速器】,依照【操作文档】进行配置。

安装 Open WebUI

LaTeX

TUNA 下载并安装 MacTeX.pkg

参考 Perlbrew 安装

curl -L https://install.perlbrew.pl | bash
perlbrew install perl-5.41.9
perlbrew switch perl-5.41.9

安装依赖项

cpan YAML::Tiny
cpan File::HomeDir

参考 macOS 配置 LaTeX (MacTeX + VScode + Skim),在 VS Code 中安装并配置 latex-workshop 插件。

常见问题

  1. Recipe terminated with fatal error: spawn latexmk ENOENT 可尝试重启 VS Code 或 MacOS。

  2. Package minted Error: You must have 'pygmentize' installed to use this package

pipx install Pygments

aria2

brew install aria2
mkdir ~/.aria2

创建 ~/.aria2/aria2.conf

bt-enable-lpd=true
bt-save-metadata=true
bt-tracker=
continue=true
dht-file-path=${HOME}/.aria2/dht.dat
dht-file-path6=${HOME}/.aria2/dht6.dat
enable-dht=true
enable-dht6=true
log=${HOME}/.aria2/aria2.log

~/.zshrc 中新建一个函数

aria2_update() {
    sed -i '' "s@^bt-tracker=.*@bt-tracker=$(curl -fsSL https://trackerslist.com/all_aria2.txt)@" ~/.aria2/aria2.conf
}

其他

配置 Internet Accounts。

常见问题

禁止程序开机自动启动

Mac 上安装的一些软件总是擅自自动启动,在“设置”中也不能关闭,这时就需要在命令行中关闭。

Mac 使用 launchctl 管理程序。可以先执行 launchctl list 列出所有程序,从中找到相关的 Label。例如,找到“小航”对应的程序

$ launchctl list                                        
PID	Status	Label
...
719 0       cn.edu.buaa.xiaohang.launcher
...

然后需要查找程序的 plist 文件

$ locate cn.edu.buaa.xiaohang.launcher.plist
/Applications/buaa_xiaohang.app/Contents/Library/LaunchAgents/cn.edu.buaa.xiaohang.launcher.plist
/Applications/buaa_xiaohang.app/Contents/Resources/cn.edu.buaa.xiaohang.launcher.plist.old
/Library/LaunchAgents/cn.edu.buaa.xiaohang.launcher.plist

/Applications/ 目录下的是程序内部文件,/Library/LaunchAgents/cn.edu.buaa.xiaohang.launcher.plist 才是我们要找的文件。根据安装方式的不同,这个 plist 文件可能出现在不同的位置,具体可以参考 https://zhuanlan.zhihu.com/p/596324385

要禁止“小航”自动启动,可以执行

sudo mv /Library/LaunchAgents/cn.edu.buaa.xiaohang.launcher.plist /Library/LaunchAgents/cn.edu.buaa.xiaohang.launcher.plist.bak

无法打开应用

Mac 会禁止用户打开一些程序。为了绕开这种限制,可以执行

xattr -dr com.apple.quarantine /Applications/buaa_xiaohang.app

参考 https://www.reddit.com/r/applehelp/comments/135ue9w/mac_is_telling_me_this_is_malware_but_its_not_it/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

LutingWang

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值