Homebrew
参考 TUNA 安装 Homebrew 。
cd
echo 'export HOMEBREW_BREW_GIT_REMOTE="https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git"' >> .zprofile
echo 'export HOMEBREW_CORE_GIT_REMOTE="https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git"' >> .zprofile
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
source .zprofile
git clone --depth=1 https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/install.git brew-install
bash brew-install/install.sh
rm -rf brew-install
# brew 命令的地址需要查看上一步的输出中的 `Next steps`
# e.g. echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> .zprofile
echo 'eval "$(/path/to/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)。
LaTeX
从 TUNA 下载并安装 MacTeX.pkg
。
参考 Perlbrew 安装
curl -L https://install.perlbrew.pl | bash
perlbrew install perl-5.36.0
perlbrew switch perl-5.36.0
安装依赖项
cpan YAML::Tiny
cpan File::HomeDir
在 VS Code 中安装 latex-workshop
插件,将如下配置加入 settings.json
{
"latex-workshop.latex.tools": [
{
"name": "latexmk",
"command": "latexmk",
"args": [
"--shell-escape",
"-synctex=1",
"-interaction=nonstopmode",
"-file-line-error",
"-pdf",
"-outdir=%OUTDIR%",
"%DOC%"
],
"env": {}
},
{
"name": "lualatexmk",
"command": "latexmk",
"args": [
"--shell-escape",
"-synctex=1",
"-interaction=nonstopmode",
"-file-line-error",
"-lualatex",
"-outdir=%OUTDIR%",
"%DOC%"
],
"env": {}
},
{
"name": "xelatexmk",
"command": "latexmk",
"args": [
"--shell-escape",
"-synctex=1",
"-interaction=nonstopmode",
"-file-line-error",
"-xelatex",
"-outdir=%OUTDIR%",
"%DOC%"
],
"env": {}
},
{
"name": "latexmk_rconly",
"command": "latexmk",
"args": [
"%DOC%"
],
"env": {}
},
{
"name": "pdflatex",
"command": "pdflatex",
"args": [
"--shell-escape",
"-synctex=1",
"-interaction=nonstopmode",
"-file-line-error",
"%DOC%"
],
"env": {}
},
{
"name": "bibtex",
"command": "bibtex",
"args": [
"%DOCFILE%"
],
"env": {}
},
{
"name": "rnw2tex",
"command": "Rscript",
"args": [
"-e",
"knitr::opts_knit$set(concordance = TRUE); knitr::knit('%DOCFILE_EXT%')"
],
"env": {}
},
{
"name": "jnw2tex",
"command": "julia",
"args": [
"-e",
"using Weave; weave(\"%DOC_EXT%\", doctype=\"tex\")"
],
"env": {}
},
{
"name": "jnw2texminted",
"command": "julia",
"args": [
"-e",
"using Weave; weave(\"%DOC_EXT%\", doctype=\"texminted\")"
],
"env": {}
},
{
"name": "pnw2tex",
"command": "pweave",
"args": [
"-f",
"tex",
"%DOC_EXT%"
],
"env": {}
},
{
"name": "pnw2texminted",
"command": "pweave",
"args": [
"-f",
"texminted",
"%DOC_EXT%"
],
"env": {}
},
{
"name": "tectonic",
"command": "tectonic",
"args": [
"--synctex",
"--keep-logs",
"%DOC%.tex"
],
"env": {}
}
],
"latex-workshop.latexindent.args": [
"-c",
"%DIR%/",
"%TMPFILE%",
"-l",
"%WORKSPACE_FOLDER%/.latexindent.yaml",
"-m"
]
}
常见问题
-
Recipe terminated with fatal error: spawn latexmk ENOENT
参考 macOS 配置 LaTeX ( MacTeX + VScode + Skim ) ,可优先尝试重启 VS Code 或 MacOS 。 -
Package minted Error: You must have ‘pygmentize’ installed to use this package
使用系统pip
运行
pip install Pygments