Mac卸载Pandoc
在用Typora导出word时提示需要安装Pandoc,Pandoc有两种安装方式,第一种是通过安装器安装
第二种方式是使用brew
brew install pandoc
但如果你使用第一种方式安装了,但想卸载了使用第二种方式安装,该怎么卸载呢?
#!/usr/bin/perl# Script to remove all files installed by the macOS pandoc installer
# and unregister the package. Modified from a script contributed
# by Daniel T. Staal.use warnings;
use strict;use File::Spec;# The main info: this is the list of files to remove and the pkg_id.
my $pkg_id = 'net.johnmacfarlane.pandoc';# Find which, if any, volume Pandoc is installed on.
my $volume;# First check /, then other volumes on the box.
my $cur_test = `pkgutil --pkgs=$pkg_id`;
if ( $cur_test =~ m/$pkg_id/ ) {$volume = '/';
} else {opendir( my $dh, '/Volumes' ) or die "Can't list Volumes: $!\n";foreach my $dir ( readdir($dh) ) {next if $dir =~ m/^\./; # Skip dotfiles.my $path = File::Spec->rel2abs( $dir, '/Volumes' );next if !( -d $path ); # Skip anything that isn't a directory.my $cur_test = `pkgutil --pkgs=$pkg_id --volume '$path'`;if ( $cur_test =~ m/$pkg_id/ ) {$volume = $path;last;}}
}die "Pandoc not installed.\n" if !( defined($volume) );# Get the list of files to remove.
my @pkg_files = `pkgutil --volume '$volume' --only-files --files '$pkg_id'`;
@pkg_files = map { chomp; File::Spec->rel2abs($_, $volume) } @pkg_files;# Confirm uninistall with the user.
print "The following files will be deleted:\n\n";
print join("\n", @pkg_files);
print "\n\n";
print "Do you want to proceed and uninstall pandoc (Y/N)?";
my $input = <STDIN>;if ($input =~ m/^[Yy]/) {# Actually remove the files.foreach my $file (@pkg_files) {if ( -e $file ) {if ( system( 'sudo', 'rm', $file ) == 0 ) {warn "Deleted $file\n";} else {warn "Unable to delete $file: $?\n";die "Aborting Uninstall.\n";}} else {warn "File $file does not exist. Skipping.\n";}}# Clean up the install.if (system('sudo', 'pkgutil', '--forget', $pkg_id, '--volume', $volume) != 0) {die "Unable to clean up install: $?\n";}} else {print "OK, aborting uninstall.\n";exit;
}print "Pandoc has been successfully uninstalled.\n";
exit;
将上面的代码保存在uninstall-pandoc.pl里
perl uninstall-pandoc.pl
The following files will be deleted:/._usr
/usr/._local
/usr/local/._bin
/usr/local/._share
/usr/local/bin/._pandoc
/usr/local/bin/pandoc
/usr/local/share/._man
/usr/local/share/man/._man1
/usr/local/share/man/man1/._pandoc.1
/usr/local/share/man/man1/pandoc.1Do you want to proceed and uninstall pandoc (Y/N)?
不得不说Homebrew真香
参考:
https://pandoc.org/installing.html#macos
https://imonce.github.io/2018/09/28/Mac%E5%A6%82%E4%BD%95%E5%8D%B8%E8%BD%BDpandoc/
Mac卸载Pandoc相关推荐
- mac 卸载 node并重新安装
系统升级到 Sierra 之后,npm 经常出问题,最终把 node 卸载了,安装了新版本.mac 卸载 node 比较麻烦,stackoverflow 上面找到一个方法还不错,特地记录下来,代码如下 ...
- mac卸载软件怎么卸载干净?详细方法教程分享
Mac如何卸载软件呢?通常我们的做法都是将应用程序图标移动到废纸篓中,这样就算是将mac软件卸载了,但是这样真的将软件卸载干净了吗?当然没有,一个软件并不是只有应用程序包,他还会包含很多的偏好文件等等 ...
- mac卸载了xcode后,运行软件提示:xcode-select: error: invalid developer directory
mac卸载了xcode后,运行软件提示:xcode-select: error: invalid developer directory 解决方法: xcode-select --install
- mac卸载和安装openjdk
mac卸载和安装openjdk 1.卸载jdk(可省略) java -version 检查是否有jdk,有且非openJDK则卸载,否则跳过此步骤 打开终端输入: sudo rm -fr /Libra ...
- Mac卸载jdk和java
Mac卸载jdk和java 一.卸载jdk 打开终端 输入 删除运行路径和运行环境 sudo rm -fr /Library/Internet\ Plug-Ins/JavaAppletPlugin.p ...
- mac卸载软件会有残留吗 mac卸载软件在哪里彻底卸载
Mac电脑和Windows电脑大不相同,很多用户认为Windows电脑卸载后需要清理卸载残留,而Mac电脑不需要清理卸载残留,真的是这样吗?mac卸载软件会有残留吗?使用Mac电脑的小伙伴经常会遇到这 ...
- Mac 卸载 隐蔽软件 Core_Sync 的步骤
Mac 卸载 隐蔽软件 Core_Sync 的步骤: 先打开Core_Sync应用: 再打开活动监视器App: 接着在活动监视器中找到你要卸载的Core_Sync并且双击它便会出现详情界面: 再接着点 ...
- 最好用的mac卸载软件App Cleaner Pro Mac中文版
App Cleaner Pro Mac中文破解版是一款非常好用的mac卸载软件,可以帮助您快速卸载mac应用,并且还附带垃圾清理的功能.App Cleaner Pro Mac破解版主要是通过删除服务文 ...
- Mac如何卸载软件 最简单的mac卸载软件方法
Mac如何卸载软件 最简单的mac卸载软件方法 http://www.mycleanmymac.com/xiazaianzhuang/mac-xzrj.html
- mac卸载软件如何彻底卸载?试试这个mac储存空间清理法
随着mac电脑使用时间的增长,明明下载的软件并不多,但是电脑却提示存储空间不足.很大一部分原因是卸载软件未卸载干净,或者未及时清理系统的垃圾文件.那么mac卸载软件在哪里彻底卸载呢?mac存储空间又该 ...
最新文章
- jenkins配置git
- Elasticsearch搜索类型讲解(QUERY_THEN_FETCH,QUERY_AND_FEATCH,DFS_QUERY_THEN_FEATCH和DFS_QUERY_AND_FEATCH)...
- python使用阿里云sdk
- 2017 全球超大规模数据中心已超过 390 个,中国仅占 8%
- 【转】Unity中写GLSL(一)—— 简单的diffuse color
- plsql(轻量版)_记录类型2
- Apache vs Nginx vs Tomcat vs JBoss vs Jetty
- Spring MVC 接收json自动转换JSONObject
- 本地可以使用oracle吗,Oracle - PLS-00642:SQL语句中不允许使用本地集合类型
- vs怎么把文字超链接_怎么拥有自己设计的简单个人网站(超细节)
- 用DELPHI为ASP开发文件上载组件
- 分形之谢尔宾斯基(Sierpinski)三角形
- 冷冻水和冷却水的区别
- 手机数据安全成为315晚会重灾区
- Jump Server
- git 账号密码问题
- 共模电感适用的频率_共模电感磁芯的选择决定其性能和应用场景——原文转自金昊德官网...
- 活着活着,就明白了(精辟)
- 中级工程师专业有哪些?职称申报有哪些要求?伴德诚
- java string长度字节_java String类型数据的字节长度
热门文章
- 使用git push没有报错,但是远程仓库没有更新的问题
- 人工智能-语音交互-NLP自然语言(三) 语法-敲黑板
- 【虚拟机Linux系统】如何将系统语言由英文改成中文?
- 计算机的音乐怎样弹生日快乐,5 分钟让你学会用吉他弹《生日快乐》歌
- php图片png转APNG,APNG\WEBP图片格式转换器
- 如何使用swagger的API接口获取数据并且封装
- 酒店管理系统用什么服务器,用勤哲Excel服务器实现酒店管理系统
- 【社会经验】如何高效的学习?
- 亲测有效sudo: /etc/sudoers is world writable sudo: no valid sudoers sources found, quitting sudo: una
- android机器人方向,Android横版过关类游戏推荐《机器人大挑战》