Typora安装 pandoc 以及 homebrew(Macos M2)

引言

  • 问题:需要使用 typora 将 .md 文件导出为.docx文件,缺少必要配件如下图所示:
  • 所以本文分为三部分,第一部分是如何下载 homebrew,第二部分是使用 homebrew 来升级 pandoc(因为我下载的 pandoc 是 1.9,而要求是>=2.0,homebrew 可以对 mac 上的包进行升级满足要求),第三部分是如何设置 pandoc 路径问题

安装 homebrew

  • 直接搜homebrew 下载,由于是 macos(m2)版,所以去的其GitHub 官网地址,结果下载安装的时候遇到以下问题,根据提示执行命令依然是失败的,所以参考了安装 homebrew
  • 下载 homebrew,我选择的是中科大的,下载速度还挺快的,阿里的也用了很慢,so...,然后下载好 homebrew 后会提示是否继续安装其他组件(如下图所示),一路 Y 即可,因为提示大部分是中文还是比较友好的
txt 复制代码
/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"

  • 验证是否安装成功
txt 复制代码
brew --version
  • 更新
txt 复制代码
brew update
  • 更换下载源(此处未测试,仅供参考)
txt 复制代码
# 更换brew.git
git -C "$(brew --repo)" remote set-url origin https://mirrors.ustc.edu.cn/brew.git # 中科大
或
git -C "$(brew --repo)" remote set-url origin https://mirrors.aliyun.com/homebrew/brew.git # 阿里巴巴
或
git -C "$(brew --repo)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git # 清华大学

# 更换homebrew-core.git
git -C "$(brew --repo homebrew/core)" remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git # 中科大
或
git -C "$(brew --repo homebrew/core)" remote set-url origin https://mirrors.aliyun.com/homebrew/homebrew-core.git # 阿里巴巴
或
git -C "$(brew --repo homebrew/core)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git # 清华大学

# 更换homebrew-cask.git
git -C "$(brew --repo homebrew/cask)" remote set-url origin https://mirrors.ustc.edu.cn/homebrew-cask.git # 中科大
或
git -C "$(brew --repo homebrew/cask)" remote set-url origin https://mirrors.aliyun.com/homebrew/homebrew-cask.git # 阿里巴巴
或
git -C "$(brew --repo homebrew/cask)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-cask.git # 清华大学

# 更换homebrew-bottles
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.aliyun.com/homebrew/homebrew-bottles' >> ~/.bash_profile # 阿里云
或
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles/bottles' >> ~/.bash_profile # 中科大
或
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles/bottles' >> ~/.bash_profile # 清华大学
# 如果终端使用的 zsh,就写入 zsh 配置文件中
source ~/.bash_profile

# 恢复默认源
1. git -C "$(brew --repo)" remote set-url origin https://github.com/Homebrew/brew.git
2. git -C "$(brew --repo homebrew/core)" remote set-url origin https://github.com/Homebrew/homebrew-core.git
3. git -C "$(brew --repo homebrew/cask)" remote set-url origin https://github.com/Homebrew/homebrew-cask.git
4. 删除环境变量 HOMEBREW_BOTTLE_DOMAIN
5. source ~/.bash_profile
6. brew update
  • 意外问题处理
    • 先执行brew doctor查看问题,按照指示对问题进行修复
    • 执行brew update-reset 将homebrew还原到稳定版
    • 执行brew update 更新软件包
  • 安装/更新/卸载
    • brew install node 默认安装最新版

    • brew install node@14.16.8 安装指定版本

    • brew switch node 16.0.0 切换版本

    • brew upgrade name 更新安装过的软件(如果不加软件名,就更新所有可以更新的软件)

    • brew uninstall node 卸载node

    • 其他命令以及功能可以查看上方参考链接

使用 homebrew 来更新 pandoc

  • 更新命令见上方

如何设置 typora 使用 pandoc

  • 由于我已经设置过了,不会弹出那个提示,此处就直接说问题和结果了
  • 1 当你选择设置 pandoc 的时候会提示你填写 pandoc 路径,而你在终端使用 whereis pandoc 和 which pandoc 的结果是不一样的,路径填写错了不会生效(因为我单独安装的 pandoc 显示的路径就是无法使用的,我还以为是需要重启)
  • 2 不管是哪种方式,我也不懂为啥使用点击文件图标的方式来填写路径,会啥也不显示,只能手动填写路径

结尾

  • 本文主要记录个人工作中遇到的一个问题以及解决过程,仅供参考
相关推荐
序安InToo19 分钟前
第6课|注释与代码风格
后端·操作系统·嵌入式
xyy12319 分钟前
C#: Newtonsoft.Json 到 System.Text.Json 迁移避坑指南
后端
洋洋技术笔记22 分钟前
Spring Boot Web MVC配置详解
spring boot·后端
JxWang0522 分钟前
VS Code 配置 Markdown 环境
后端
navms25 分钟前
搞懂线程池,先把 Worker 机制啃明白
后端
JxWang0525 分钟前
离线数仓的优化及重构
后端
Nyarlathotep011326 分钟前
gin01:初探gin的启动
后端·go
JxWang0527 分钟前
安卓手机配置通用多屏协同及自动化脚本
后端
JxWang0528 分钟前
Windows Terminal 配置 oh-my-posh
后端
SimonKing44 分钟前
OpenCode AI编程助手如何添加Skills,优化项目!
java·后端·程序员