我使用Homebrew Cask在OS x上安装应用程序,如何升级所有已安装的Cask ?
当前回答
这真的让我很恼火,所以我创建了这个脚本来更新所有的Brew应用程序,并允许用户选择更新哪个Cask应用程序。你也可以将应用程序排除在外。
https://github.com/derrekyoung/ScriptsAndUtils/blob/master/brew-cask-upgrade.sh
其他回答
brew cask outdated | xargs brew cask reinstall --force
这样的剧本是我自己做的。请查看github https://github.com/pesh1983/brew_cask_upgrade。它有很好的描述,但如果你有任何其他问题,请随时问我。它进行了公平的升级:卸载和安装,因此任何必要的清理将由“brew”本身执行。
我已经使用Homebrew有一段时间了(现在是2022年),下面是我最喜欢的一行命令,每天在我煮早上的咖啡时运行一次。如果您将所有或大部分应用程序作为桶,并由Homebrew管理,并且出于新功能和安全原因希望进行最新更新,那么这是非常好的。
警告:
DO NOT use in a work environment where reliability and stability is key. Although having constantly the latest security updates sounds like a good idea, what is not a good idea is getting updates as soon as they come out. If you are a software developer, modify this command and remove brew upgrade --greedy. This is because it is always better to inspect the versions of the formulae/casks that are outdated before updating for compatibility with your development environments. You are better off upgrading manually the specific formulae/casks that you are sure will not interfere with your projects, and usually that requires inspecting release notes. When separately updating casks/formulae, use brew upgrade cask_name_here.
下面是命令:brew update && brew obsolete -greedy && brew upgrade -greedy && brew cleanup
让我们来解释一下这是做什么的。
brew update命令用于在执行其他操作之前更新Homebrew本身。
brew outdated——greedy命令用于列出所有更新可用的酒桶/公式。贪心参数指定自动更新自己的应用程序和标记为version:latest的应用程序应该包含在这个列表中。
The brew upgrade --greedy command is used to update all casks/formulae which were previously listed as outdated. The greedy parameter specifies that apps that auto update themselves and one's flagged with the version:latest should be included in this update process. Be aware that if you see no output in the terminal after running this command it means that there is nothing to update, unlike the brew outdated command this one does not send a message back to the terminal informing users that nothing needs updating.
brew cleanup命令删除所有公式和桶的旧锁文件和过时下载,并删除已安装公式的旧版本。简单地说,就是这些桶/公式以前版本的旧文件或剩余文件。
开发人员和工作环境的潜在解决方案 如果你想使用如上所述的这个解决方案,并且在Homebrew中有关键的依赖关系,有一个解决方案:
brew pin [package_name_here]
当所有包都用上面的命令更新时,pin命令将停止Homebrew更新指定的包。有关更多信息,这里是将该功能添加到Homebrew的pull请求。
带有'auto_updates'或'version:latest'的桶将不会升级;通过——贪婪地升级它们:
brew upgrade --cask --greedy
可以列出已安装的桶:
brew cask list
并强制重新安装桶与:
brew cask install --force CASK_NAME
因此,将第一个命令的输出输出到第二个命令中,我们更新了所有的桶:
brew cask list | xargs brew cask install --force
推荐文章
- 如何在Mac上的命令行安装JQ ?
- 在Mac OS X上安装/升级gradle
- 如何在终端中提高光标速度?
- Objective-C中的自动引用计数不能防止或减少什么样的泄漏?
- 如何在Mac OS安装时停止MySQL ?
- PIP成功安装包,但在命令行中找不到可执行文件
- 无法在Mac OS X 10.9上安装Lxml
- 在OS X上使用sed进行就地编辑
- MacVim和普通Vim有什么区别?
- 查看保存的NSUserDefaults的简单方法?
- homebrew、macports或其他软件包安装工具的区别/用途是什么?
- (Mac) -bash: __git_ps1:命令未找到
- 如何创建Bash别名?
- Java/JDK的苹果硅芯片
- Ruby Bundle Symbol not found: _SSLv2_client_method (LoadError)