在 Homebrew 中返回 readline 版本 6.x 以修复 Postgresql?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/39823011/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Return to readline version 6.x in Homebrew to fix Postgresql?
提问by ericky
I'm no Homebrew expert but I think it has "upgraded" me from readline version 6.x to 7.0 sometime after 9/15/16:
我不是 Homebrew 专家,但我认为它在2016 年 9 月 15 日之后的某个时间将我从 readline 版本 6.x“升级”到了 7.0 :
eat@eric-macbook:Homebrew$ brew info readline
readline: stable 7.0 (bottled) [keg-only]
Library for command-line editing
https://tiswww.case.edu/php/chet/readline/rltop.html
/usr/local/Cellar/readline/7.0 (45 files, 2M)
This has caused headaches for my 9.4.5 Homebrew version of Postgresql (I need the older 9.4 for comparability reasons):
这给我的 9.4.5 Homebrew 版本的 Postgresql 带来了麻烦(出于可比性的原因,我需要旧的 9.4):
eat@eric-macbook:~$ psql --version
dyld: Library not loaded: /usr/local/opt/readline/lib/libreadline.6.dylib
Referenced from: /usr/local/Cellar/postgresql/9.4.5/bin/psql
Reason: image not found
Trace/BPT trap: 5
Unfortunately I can't find a 6.x version of readline on Homebrew to revert to - only 7.0 seems to be available(?).
不幸的是,我在 Homebrew 上找不到要恢复到的 6.x 版本的 readline - 似乎只有 7.0 可用(?)。
My question is twofold:
我的问题是双重的:
- Is the the readline version mismatch the cause of my postgres/psql problem?
- If so, how do I return to 6.x with Homebrew to correct the problem?
- readline 版本不匹配是导致我的 postgres/psql 问题的原因吗?
- 如果是这样,我如何使用 Homebrew 返回 6.x 以纠正问题?
Thank you in advance!
先感谢您!
回答by DanEEStar
To answer the specific question.
回答具体问题。
You can switch between version of installed brew packages which are still around locally as explained in this question: Homebrew install specific version of formula?
您可以在本地仍然存在的已安装 brew 包版本之间切换,如以下问题所述: Homebrew install specific version of formula?
To downgrade to readline 6.x the following command worked for me:
要降级到 readline 6.x,以下命令对我有用:
brew switch readline 6.3.8
回答by vitalie
Just reinstall postgresql94
package, the PostgreSQL 9.4 will use the new readline
package:
只需重新安装postgresql94
包,PostgreSQL 9.4 将使用新readline
包:
brew reinstall postgresql94
回答by Sam Kah Chiin
NOTE: This answer might be outdated due to the changes in the branch (as reported by Andrew, the commit disappear)
注意:由于分支中的更改,此答案可能已过时(如 Andrew 所报告,提交消失)
To those who still facing this issue but cannot download the readline 6.3.8 from the homebrew package. You can try this solution. (Refer from here)
对于那些仍然面临这个问题但无法从自制软件包下载 readline 6.3.8 的人。你可以试试这个解决方案。(从这里参考)
# Uninstall this incompatible version
brew uninstall readline
# Go to the local clone of homebrew-core
cd $(brew --prefix)/Homebrew/Library/Taps/homebrew/homebrew-core
# Move to the homebrew-core revision that had 6.3.8
git checkout 35fed817726f61a9d40c8420582f6fde59eb5f14
# Re-install readline
brew reinstall readline
# Switch back to HEAD
git checkout master
# Pin readline so this can't happen again
brew pin readline
回答by bkunzi01
For people coming from Rails with this issue you can just add the readline gem and run bundle install
.
对于来自 Rails 的有此问题的人,您只需添加 readline gem 并运行bundle install
.
gem 'rb-readline' #Fixed readline error
回答by Seth Bro
I was able to overcome this with a blanket brew upgrade
(upgrade all brew-managed packages).
我能够用毯子克服这个问题brew upgrade
(升级所有 brew 管理的软件包)。
回答by user2679290
If you would use Sam Kah Chiin's solution, you can ignore the 404.
如果您使用 Sam Kah Chiin 的解决方案,则可以忽略 404。
Apply the extra change so it would work on new macOS:
应用额外的更改,使其适用于新的 macOS:
diff --git a/Formula/readline.rb b/Formula/readline.rb
index 08d3728..d67e5e4 100644
--- a/Formula/readline.rb
+++ b/Formula/readline.rb
@@ -16,7 +16,7 @@ class Readline < Formula
sha256 "c129333634dd00ab2267ae9c531fca1f5cc50dd519ed3399918289fdfdf2663b" => :lion
end
- keg_only :shadowed_by_osx, <<-EOS.undent
+ keg_only :shadowed_by_macos, <<~EOS
OS X provides the BSD libedit library, which shadows libreadline.
In order to prevent conflicts when programs look for libreadline we are
defaulting this GNU Readline installation to keg-only.
Do sudo update_dyld_shared_cache
at the end
不要sudo update_dyld_shared_cache
在最后