如何在自制程序中安装特定版本的公式?例如,postgresql-8.4.4而不是最新的9.0。
当前回答
意外升级Postgres?
我的案例:
postgresql意外地从11升级到12(在运行brew升级后没有参数)我想让Postgres保持11岁。
解决方案:
停止数据库:
brew services stop postgresql
安装Postgres 11:
brew install postgresql@11
启用它:
brew link postgresql@11 --force
(可选)将数据库数据目录从postgres重命名为postgres@11:
cd /usr/local/var
ls -lh
mv postgresql@11 postgresql@11-fresh-backup
mv postgres postgresql@11
启动数据库:
brew services start postgresql@11
如果有任何错误,请检查/usr/local/var/log/postgresql@11.log(注意@11)。
其他回答
按照@halfcube的建议,这非常有效:
查找您要查找的库https://github.com/Homebrew/homebrew-core/tree/master/Formula单击它:https://github.com/Homebrew/homebrew-core/blob/master/Formula/postgresql.rb单击“历史记录”按钮查看旧提交:https://github.com/Homebrew/homebrew-core/commits/master/Formula/postgresql.rb单击所需的选项:“postgresql:update version to 8.4.4”,https://github.com/Homebrew/homebrew-core/blob/8cf29889111b44fd797c01db3cf406b0b14e858c/Formula/postgresql.rb单击“原始”链接:https://raw.githubusercontent.com/Homebrew/homebrew-core/8cf29889111b44fd797c01db3cf406b0b14e858c/Formula/postgresql.rbbrew安装https://raw.githubusercontent.com/Homebrew/homebrew-core/8cf29889111b44fd797c01db3cf406b0b14e858c/Formula/postgresql.rb
基于@tschundee和@Debilski的更新1所描述的工作流,我自动化了该过程,并在此脚本中添加了清理。
下载它,将其放到您的路径中,然后brewv<formula_name><wanted_version>。对于特定OP,它将是:
cd path/to/downloaded/script/
./brewv postgresql 8.4.4
:)
对于brew的最后一个版本来说,这很容易做到。
brew tap homebrew/versions
brew install subversion17 # for svn 1.7 branch instead of last available
brew install postgresql8 # for postgresql 8 (which you ask)
这里的其他答案很好,但如果您需要安装较旧版本的软件包并确保修改了软件包名称,则需要另一种方法。当使用脚本(在我的例子中是PHP构建脚本)时,这一点非常重要,这些脚本使用brew前缀package_name来确定要用于编译的目录。
如果您正在使用brew提取,则会在包名称的末尾添加一个版本,这将中断brew前缀查找。
以下是如何在保持原始软件包名称的同时安装较旧的软件包版本:
# uninstall the newer version of the package that you accidentally installed
brew uninstall --ignore-dependencies icu4c
# `extract` the version you'd like to install into a custom tap
brew tap-new $USER/local-tap
brew extract --version=68.2 icu4c $USER/local-tap
# jump into the new tap you created
cd $(brew --repository $USER/local-tap)/Formula
# rename the formula
mv icu4c@68.2.rb icu4c.rb
# change the name of the formula by removing "AT682" from the `class` definition
# the exact text you'll need to remove will be different
# depending on the version you extracted
nano icu4c.rb
# then, install this specific formula directly
brew install $(brew --repository $USER/local-tap)/Formula/icu4c.rb
我在这里写了更多。
我发现了比其他复杂解决方案更好的替代方案。
brew install https://raw.github.com/Homebrew/homebrew-versions/master/postgresql8.rb
这将下载并安装PostgreSQL 8.4.8
我通过开始遵循搜索回购和回购中的注释的步骤找到了这个解决方案。
经过一番研究发现,有人收集了一些罕见的配方奶粉。
如果您正在查找MySQL 5.1.x,请尝试一下。
brew install https://raw.github.com/Homebrew/homebrew-versions/master/mysql51.rb
推荐文章
- 在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 '
- 升级所有通过家酿桶安装的桶
- 如何在OSX上更新Xcode到最新版本?
- 如何找到Homebrew的可安装软件包列表?