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 不管是哪种方式,我也不懂为啥使用点击文件图标的方式来填写路径,会啥也不显示,只能手动填写路径

结尾

  • 本文主要记录个人工作中遇到的一个问题以及解决过程,仅供参考
相关推荐
FungLeo6 天前
FengCMS · PHP+MySQL 升级实录 · 编辑器迁移:KindEditor → wangEditor5 +服务端 HTML Purifier
mysql·编辑器·php·富文本编辑器·fengcms
aaaameliaaa7 天前
VSCode的安装与配置
ide·笔记·vscode·编辑器
ScilogyHunter9 天前
[14] TMS570LC4357_VIM向量中断:128 通道、双 VIM 与硬件向量分发
单片机·编辑器·vim·excel·hercules·tms570
wangqiaowq10 天前
Protégé 开源本体(Ontology)编辑器
编辑器
NoteDeep 深度笔记12 天前
DOM 被改乱了怎么办?Notedeep 编辑器的 normalize 设计
前端·javascript·编辑器
Solange__14 天前
Blender 3D模型优化:普通复制、共享网格、实例、合并怎么选?
人工智能·3d·ai·自然语言处理·编辑器·blender·材质
FungLeo16 天前
成为全栈·Vue 管理后台篇·编辑器图片上传:从文件选择到文章附件关联
前端·vue.js·编辑器·markdown·文件上传·formdata·附件管理
caoliaoerweima18 天前
草料二维码小程序上线活码编辑器:手机上也能编辑活码了
智能手机·小程序·编辑器·草料二维码
慧都产品智能化19 天前
Qt 表格升级攻略:复用已有编辑器,减少重复开发
c++·qt·编辑器·qt6.3
DFT计算杂谈19 天前
可DIY布里渊区图像绘制编辑器
人工智能·机器学习·语言模型·矩阵·编辑器