如何在自制程序中安装特定版本的公式?例如,postgresql-8.4.4而不是最新的9.0。
当前回答
我刚刚将一个较旧版本的弹性搜索复制到/usr/local/Cellar/lelasticsearch目录中。
$ mkdir /usr/local/Cellar/elasticsearch/5.4.3/bin
$ cp elasticsearch /usr/local/Cellar/elasticsearch/5.4.3/bin
$ brew switch elasticsearch 5.4.3
就是这样。也许它对任何人都有用。
其他回答
家庭酿造最近发生了变化。以前有用的东西现在不管用了。我发现最简单的工作方式(2021 1月)是:
找到我的软件的.rb文件(首先转到公式,找到我需要的文件,然后单击“历史”;对于CMake,这是在https://github.com/Homebrew/homebrew-core/commits/master/Formula/cmake.rb)从修订中选择所需版本,例如3.18.4,单击.rb文件diff(…)右上角的三个点,然后单击Raw。复制URL。取消链接旧版本brew取消链接cmake直接从gitURL安装不再有效(brew-installhttps://raw.githubusercontent.com/Homebrew/homebrew-core/2bf16397f163187ae5ac8be41ca7af25b5b2e2cc/Formula/cmake.rb将失败)相反,下载它并从本地文件curl-O安装https://raw.githubusercontent.com/Homebrew/homebrew-core/2bf16397f163187ae5ac8be41ca7af25b5b2e2cc/Formula/cmake.rb&&brew安装/克马克.rb
瞧!现在可以删除下载的.rb文件。
如果无法使用brew search<formula>找到您的版本,您也可以尝试查看公式的提交日志,以找到所需的版本:
下面是通过brew安装旧版本nginx的示例:
ngxnx公式提交日志参见nginx:更新1.6.3瓶装eba75b9a1a474b9fc4df30bd0a32637fa31ec049
从那里,我们可以使用sha和原始git url安装1.6.3:
brew安装https://raw.githubusercontent.com/Homebrew/homebrew/eba75b9a1a474b9fc4df30bd0a32637fa31ec049/Library/Formula/nginx.rb
更新Library/Formal/postgresql.rb第8行至
http://ftp2.uk.postgresql.org/sites/ftp.postgresql.org/source/v8.4.6/postgresql-8.4.6.tar.bz2
第9行的MD5
fcc3daaf2292fa6bf1185ec45e512db6
保存并退出。
brew install postgres
initdb /usr/local/var/postgres
现在在这个阶段,您可能会遇到postgresql无法创建共享内存段错误,要解决这个问题,请像这样更新/etc/sysctl.conf:
kern.sysv.shmall=65536
kern.sysv.shmmax=16777216
再次尝试initdb/usr/local/var/postgres,它应该运行平稳。
在启动时运行postgresql
launchctl load -w /usr/local/Cellar/postgresql/8.4.6/org.postgresql.postgres.plist
希望有助于:)
⚠ 这个答案在2020年12月后不再有效:在HomeBrew 2.7.0中禁用了brew开关(2.6.0中已弃用)
对于2.7之前的Homebrew版本:
现在有一种更简单的方法来安装以前安装的公式的旧版本。简单使用
brew switch [formula] [version]
例如,我定期在Node.js 0.4.12和0.6.5之间切换:
brew switch node 0.4.12
brew switch node 0.6.5
由于brew开关只是更改符号链接,所以速度非常快。请参阅外部命令下Homebrew Wiki的更多文档。
以下是我如何降级KOPS(不支持版本控制)
# brew has a git repo on your localhost
cd /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core
git remote -v
origin https://github.com/Homebrew/homebrew-core (fetch)
origin https://github.com/Homebrew/homebrew-core (push)
# find the version of kops.rb you need
git log Formula/kops.rb
# checkout old commit
# kops: update 1.18.1 bottle.
git checkout 2f0ede7f27dfc074d5b5493894f3468f27cc73f0 -- Formula/kops.rb
brew unlink kops
brew install kops
# now we have old version installed
ls -1 /usr/local/Cellar/kops/
1.18.1
1.18.2
which kops
/usr/local/bin/kops
ls -l /usr/local/bin/kops
/usr/local/bin/kops -> ../Cellar/kops/1.18.1/bin/kops
kops version
Version 1.18.1
# revert to the newest version
brew uninstall kops
git checkout -f
brew link kops
kops version
Version 1.18.2
推荐文章
- Homebrew:以新的formula@version格式列出可用版本
- 错误:无法在ARM处理器上的Homebrew中安装英特尔默认前缀(/usr/local)
- 酿造更新失败:未跟踪的工作树文件将被合并覆盖
- 在MacOS X上推荐用什么方式安装Node.js、nvm和npm ?
- 我如何安装imagemagick与自制?
- 我如何知道哪些自制配方是可升级的?
- "ERROR:root:code for hash md5 was not found"当使用任何hg mercurial命令时
- homebrew、macports或其他软件包安装工具的区别/用途是什么?
- Ruby Bundle Symbol not found: _SSLv2_client_method (LoadError)
- Virtualenvs中的破引用
- brew install XXX和brew cask install XXX有什么区别
- Brew安装docker不包括docker引擎?
- 我如何使用brew安装Python作为默认的Python?
- 如何用自制程序更新公式?
- 在安装Homebrew后,我得到' zsh:命令未找到:brew '