Ruby on rails 3 当从IntelliJ IDea运行时,位于相同路径的psql和pg_转储在Rakefile中返回不同的版本信息

Ruby on rails 3 当从IntelliJ IDea运行时,位于相同路径的psql和pg_转储在Rakefile中返回不同的版本信息,ruby-on-rails-3,macos,postgresql,intellij-idea,rubymine,Ruby On Rails 3,Macos,Postgresql,Intellij Idea,Rubymine,在IDea 11.1.3中,构建IU#117.798,并尝试使用其Ruby插件在使用Rails 3.2.8的项目中运行规范,Ruby 1.9.3p194(2012-04-20修订版35410)[x86_64-darwin11.4.0] 我认为这与在OSX Lion Server(10.7.5)上安装postgres的自制版本有关,我在pg的OSX Server版本之前已经安装了该版本 在Terminal.app中: $ whereis pg_dump /usr/bin/pg_dump $ pg_

在IDea 11.1.3中,构建IU#117.798,并尝试使用其Ruby插件在使用Rails 3.2.8的项目中运行规范,Ruby 1.9.3p194(2012-04-20修订版35410)[x86_64-darwin11.4.0]

我认为这与在OSX Lion Server(10.7.5)上安装postgres的自制版本有关,我在pg的OSX Server版本之前已经安装了该版本

在Terminal.app中:

$ whereis pg_dump
/usr/bin/pg_dump
$ pg_dump -V
pg_dump (PostgreSQL) 9.1.3
$ psql -V
psql (PostgreSQL) 9.1.3
contains support for command-line editing
$ /path/to/home/.rvm/rubies/ruby-1.9.3-p194/bin/ruby -e 'puts "#{`pg_dump -V`}"'
pg_dump (PostgreSQL) 9.1.3
$ /path/to/home/.rvm/rubies/ruby-1.9.3-p194/bin/ruby -e 'puts "#{`psql -V`}"'
psql (PostgreSQL) 9.1.3
contains support for command-line editing
如果我将此添加到我的Rakefile:

raise "whereis pg_dump = #{`whereis pg_dump`}, pg_dump -V = #{`pg_dump -V`}, psql -V = #{`psql -V`}"
在IDea中,当我运行->调试->规范时,控制台中会显示以下内容:

/path/to/home/.rvm/rubies/ruby-1.9.3-p194/bin/ruby -e at_exit{sleep(1)};$stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift) /path/to/home/.rvm/gems/ruby-1.9.3-p194@some_project/gems/ruby-debug-ide-0.4.17.beta14/bin/rdebug-ide --port 51515 -- /path/to/home/.rvm/gems/ruby-1.9.3-p194@global/bin/rake spec
Testing started at 10:59 AM ...
Fast Debugger (ruby-debug-ide 0.4.17.beta14, ruby-debug-base 0.11.30.pre10) listens on 127.0.0.1:51515
rake aborted!
whereis pg_dump = /usr/bin/pg_dump
, pg_dump -V = pg_dump (PostgreSQL) 9.0.5
, psql -V = psql (PostgreSQL) 9.0.5

(See full trace by running task with --trace)

Process finished with exit code 137

你知道为什么在同一路径上的二进制文件会有不同的版本吗?

path
在RubyMine和Terminal中是不同的。要使其与从终端运行RubyMine相同,请执行以下操作:

open -a /Applications/RubyMine.app/
另一个选项是在RubyMine运行/调试配置中指定路径

相关主题:


谢谢!这两种解决方案对我都有效。在IDea中,
open-a/Applications/IntelliJ\IDea\11.app/
修复它,或运行->编辑配置->(Rake/spec),然后为使brew postgres正常工作,请单击。。。在环境变量右侧,单击+并添加值为
/usr/local/bin:/usr/local/sbin:$PATH的路径,单击确定,然后单击应用并确定。谢谢!