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

结尾

  • 本文主要记录个人工作中遇到的一个问题以及解决过程,仅供参考
相关推荐
TOSUN同星3 小时前
干货分享 | TSMaster DBC编辑器操作指南:功能详解+实战示例
数据库·oracle·编辑器·汽车·软件工程
LIN-JUN-WEI4 小时前
[ESP32]VSCODE+ESP-IDF环境搭建及blink例程尝试(win10 win11均配置成功)
c语言·开发语言·ide·vscode·单片机·学习·编辑器
Ronin30510 小时前
【Linux系统】vim编辑器 | 编译器gcc/g++ | make/Makefile
linux·运维·服务器·ubuntu·编辑器·vim
织_网11 小时前
Visual Studio Code 中统一配置文件在团队协作中的应用
ide·vscode·编辑器
雷羿 LexChien1 天前
从 Prompt 管理到人格稳定:探索 Cursor AI 编辑器如何赋能 Prompt 工程与人格风格设计(上)
人工智能·python·llm·编辑器·prompt
不知所云,1 天前
3. lvgl 9.3 vscode 模拟环境搭建 lv_port_pc_vscode-release-v9.3
ide·vscode·编辑器·c·sdl·lvgl vscode·lvgl模拟器
淡漠的蓝精灵1 天前
【2025】Sublime Text 4安装教程保姆级一键安装教程(附安装包)
其他·编辑器·sublime text
yanjiee2 天前
需要scl来指定编译器的clangd+cmake在vscode/cursor开发环境下的配置
ide·vscode·编辑器
hero_heart3 天前
vscode中c_cpp_properities.cpp文件生成和作用
ide·vscode·编辑器
FrostedLotus·霜莲3 天前
C++主流编辑器特点比较
开发语言·c++·编辑器