Homebrew及Homebrew cask安装与使用
程序员文章站
2024-03-24 17:49:40
...
安装Homebrew
安装命令:
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
如果不是第一次安装,可能会遇到如下错误:
It appears Homebrew is already installed. If your intent is to reinstall you
should do the following before running this installer again:
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"
解决方式:
sudo rm -fr /usr/local/.git
参考链接:http://*.com/questions/18555378/brew-installation-error-appears-homebrew-is-already-installed
再次安装:
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
遇到错误:
==> This script will install:
/usr/local/bin/brew
/usr/local/Library/...
/usr/local/share/man/man1/brew.1
Press RETURN to continue or any other key to abort
==> Downloading and installing Homebrew...
remote: Counting objects: 3769, done.
remote: Compressing objects: 100% (3608/3608), done.
remote: Total 3769 (delta 43), reused 527 (delta 26), pack-reused 0
Receiving objects: 100% (3769/3769), 3.21 MiB | 269.00 KiB/s, done.
Resolving deltas: 100% (43/43), done.
From https://github.com/Homebrew/homebrew
* [new branch] master -> origin/master
error: unable to unlink old 'Library/Homebrew/dev-cmd/aspell-dictionaries.rb' (Permission denied)
error: unable to unlink old 'Library/Homebrew/dev-cmd/update-test.rb' (Permission denied)
error: unable to unlink old 'Library/Homebrew/test/bottles/testball_bottle-0.1.el_capitan.bottle.tar.gz' (Permission denied)
error: unable to unlink old 'Library/Homebrew/test/bottles/testball_bottle-0.1.mavericks.bottle.tar.gz' (Permission denied)
error: unable to unlink old 'Library/Homebrew/test/bottles/testball_bottle-0.1.mountain_lion.bottle.tar.gz' (Permission denied)
error: unable to unlink old 'Library/Homebrew/test/bottles/testball_bottle-0.1.yosemite.bottle.tar.gz' (Permission denied)
fatal: Could not reset index file to revision 'origin/master'.
Failed during: git reset --hard origin/master
解决方式:
sudo mv /usr/local/Library /usr/local/Library.bk
再次安装即可。
安装Homebrew cask
Homebrew cask可用于mac应用程序或套件,比如mactex,xtrafinder等。
brew install caskroom/cask/brew-cask
使用Homebrew管理软件
安装软件
比如安装emacs和vim的命令分别如下。
- 安装emacs
brew install emacs --with-cocoa --with-gnutls
- 安装macvim
brew install macvim --with-override-system-vim
- 安装ack和ag,比grep好用
brew install ack ag
- 安装autojump,非常高效的目录跳转工具
brew install autojump
升级软件
- 查看可以升级的软件
brew outdated
- 比如升级macvim
brew upgrade macvim
- 升级所有软件
brew upgrade
查找软件包
比如查找和pdf相关的软件包。
- 查找和pdf相关的软件包
brew search pdf
删除软件包
- 移除macvim
brew uninstall macvim
清除老版本的安装包
Homebrew 会缓存下载的安装包,长时间不清理会占用大量的磁盘空间,因此需要定期清理,清理命令如下:
brew cleanup
上一篇: Homebrew使用介绍
下一篇: MacOS — Homebrew使用
推荐阅读
-
Homebrew简介及使用
-
Homebrew及Homebrew cask安装与使用
-
使用homebrew在macOS中安装nginx实现Tomcat的负载均衡集群
-
详解Docker与FastDFS的安装命令及使用
-
解决mac使用homebrew安装MySQL无法登陆问题
-
Modbus Poll与Modbus Slave安装破解教程及使用指南(附注册码)
-
Windows 10 与 MySQL 5.5 安装使用及免安装使用详细教程(图文)
-
Nginx服务器安装及配置文件与使用详解
-
vue安装和使用scss及sass与scss的区别详解
-
MongoDB 不在开源了,使用 Homebrew 安装只能玩社区版了