警告:除非在终端中手动删除文件 你先尝试过其他一切。可能导致手动删除 卸载并安装程序崩溃。
这是QA风格的帖子,分享我解决问题的途径。我确信有更好的方法
我选择了一个较旧的mac air并希望将其设置为Ruby和Rails培训。在升级过程中,我遇到了安装postgresql的问题:
➜ ~ brew install postgresql
....
==> Installing postgresql
==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/postgresql-9.3.5.mountain_lion.bottle.tar.gz
Already downloaded: /Library/Caches/Homebrew/postgresql-9.3.5.mountain_lion.bottle.tar.gz
==> Pouring postgresql-9.3.5.mountain_lion.bottle.tar.gz
==> Caveats
...
To reload postgresql after an upgrade:
launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
Error: An unexpected error occurred during the `brew link` step
The formula built, but is not symlinked into /usr/local
No such file or directory - /usr/local/Cellar/postgresql/9.2.3/include/server
Error: No such file or directory - /usr/local/Cellar/postgresql/9.2.3/include/server
我正在安装postgresql 9.3.5,我不在乎9.2.3没有被发现!
➜ ~ brew install postgresql
Warning: postgresql-9.3.5 already installed, it's just not linked
但是postgres仍然被打破了。
有什么问题?
答案 0 :(得分:12)
我有类似的问题,但有另一个包。原来,有一堆死链接指向旧版本所有其他我的文件系统。以下是我的情况:
brew link <appname>
(例如brew link postgress
); 希望有所帮助
答案 1 :(得分:5)
brew update
brew doctor
始终是第一步。
帮助查找文件,更新文件db
sudo /usr/libexec/locate.updatedb
这类似于ubuntu上的updatedb,你可能想要别名。
然后你可以执行
locate postgresql
了解有关事物的更多信息。
你有可能像我一样删除文件和文件夹(抱歉,这是一件很蠢的事情)。我学到的是,我有一堆死的符号链接。
自制软件主要使用/usr/
,更具体地说是/usr/local/bin
并将所有来源放在/usr/local/Cellar
上,将symlink local / bin放到Cellar bin
我所做的就是追捕那些死亡的符号链接并再次杀死它们。解除连结。
进入/usr/local/bin
和/usr
中的其他人,然后执行
sudo find . -type l -exec test ! -e {} \; -delete
此测试表明符号链接的目标存在,如果没有则删除。
要查找文件夹和子文件夹中的符号链接,请执行
sudo ls -lR /usr | grep \^l
# and only those pointing to something postgresql:
sudo ls -lR /usr | grep \^l | grep postgresql
这会让你更进一步。
我甚至无法安装wget,brew install wget´ because of some
wgetrc issue. I found that being a dead symlink
/ usr / local / etc / wgetrc`
清理了符号链接后,我的系统运行得更好,最后将postgresql安装为魅力
➜ brew uninstall postgresql
➜ brew install postgresql
==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/postgresql-9.3.5.mountain_lion.bottle.tar.gz
Already downloaded: /Library/Caches/Homebrew/postgresql-9.3.5.mountain_lion.bottle.tar.gz
==> Pouring postgresql-9.3.5.mountain_lion.bottle.tar.gz
==> Caveats
If builds of PostgreSQL 9 are failing and you have version 8.x installed,
you may need to remove the previous version first. See:
https://github.com/Homebrew/homebrew/issues/issue/2510
To migrate existing data from a previous major version (pre-9.3) of PostgreSQL, see:
http://www.postgresql.org/docs/9.3/static/upgrading.html
When installing the postgres gem, including ARCHFLAGS is recommended:
ARCHFLAGS="-arch x86_64" gem install pg
To install gems without sudo, see the Homebrew wiki.
To reload postgresql after an upgrade:
launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
==> /usr/local/Cellar/postgresql/9.3.5/bin/initdb /usr/local/var/postgres
==> Summary
/usr/local/Cellar/postgresql/9.3.5: 2927 files, 39M
# and in my project
➜ bundle
➜ rake db:create
➜ rake db:migrate
# YEAH!
答案 2 :(得分:0)
我在Yosemite 10.10.3上遇到了同样的问题。
我的步骤是:
然后捆绑安装并完成。
答案 3 :(得分:0)
我跑了冲泡医生,并听从了相关建议。在这种情况下
Warning: The following directories do not exist:/usr/local/include
You should create these directories and change their ownership to your account.
sudo mkdir -p /usr/local/include
sudo chown -R $(whoami) /usr/local/include
在那之后,我能够运行brew链接postgresql
答案 4 :(得分:0)
你可以试试这个
/usr/local/pgsql/bin/postgres -D /usr/local/pgsql/data >logfile 2>&1 &
答案 5 :(得分:-3)
'/usr/local/Cellar/postgresql@9.6/9.6.21/bin/pg_ctl -D /usr/local/var/postgresql@9.6 start && brew services start postgresql' 返回我未安装 postgre
brew 安装 postgresql 还我没有链接
brew 服务启动 postgresql 返回我找不到根
psql postgres