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

结尾

  • 本文主要记录个人工作中遇到的一个问题以及解决过程,仅供参考
相关推荐
哎写bug的程序员15 小时前
关于VSCode上gcc,gdb的安装配置问题
ide·vscode·编辑器
旺旺的碎冰冰~19 小时前
VScode解决终端输出中文乱码问题
ide·vscode·编辑器
Navicat中国2 天前
SQL 编辑器生产力:重构与实时错误检测
数据库·sql·重构·编辑器·navicat
不爱吃鱼的蔓热莓4 天前
释放VSCode插件占用系统盘垃圾
ide·vscode·编辑器
易知微EasyV数据可视化4 天前
会插卡片的编辑器:在 Agent 输入框里混排文字与结构化内容
人工智能·经验分享·编辑器·agent·设计
打工仔折腾 AI4 天前
SQL 编辑器不是高级记事本:KStudio 与 KSQL Developer 的建表与增删改查手法
数据库·人工智能·后端·python·sql·编辑器·ai agent 实战
志尊宝4 天前
AI原生前端开发(001):Cursor编辑器深度使用从入门到精通
前端·编辑器·ai-native
martindelophy4 天前
开源 AI 视频编辑器实战:用结构化命令连接视频生成、对话剪辑与浏览器导出
人工智能·编辑器·音视频
小师兄吃牛肉4 天前
SQL 编辑器异常排查:基于 KStudio 的一次实战记录
java·sql·编辑器
(未雨绸缪)4 天前
VScode中AI补全功能开关
编辑器