Bad interpreter: No such file or directory

Hello,

I met a problem after i tried to upgrade my ruby version. Now i have to
uninstall ruby 1.8.7 to avoid conflict with the original ruby 1.8.6 in
MAC.

But now my problem is, when i use "rake db:migrate", it says:
"-bash: /opt/local/bin/rake: /opt/local/bin/ruby: bad interpreter: No
such file or directory"

I guess the reason is that somehow it tries to look for ruby in
/opt/local/bin, however ruby is in fact in /user/bin. I tried to write
"ln -s /user/bin/ruby /opt/local/bin/ruby" in .profile, but it doesn't
work.

Here is my environment and path:
iapc11:trunk$ which ruby
/usr/bin/ruby
iapc11:trunk$ which rake
/opt/local/bin/rake
iapc11:trunk$ which rails
/opt/local/bin/rails

iapc11:trunk$ echo $PATH
/opt/local/bin:/opt/local/sbin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/teTeX/bin/i386-apple-darwin-current:/opt/local/bin:/user/bin:/Applications/TextMate.app/Contents/Resources

iapc11:trunk$ gem env
RubyGems Environment:
  - RUBYGEMS VERSION: 1.3.7
  - RUBY VERSION: 1.8.7 (2009-06-12 patchlevel 174)
[universal-darwin10.0]
  - INSTALLATION DIRECTORY: /Library/Ruby/Gems/1.8
  - RUBY EXECUTABLE:
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
  - EXECUTABLE DIRECTORY: /usr/bin
  - RUBYGEMS PLATFORMS:
    - ruby
    - universal-darwin-10
  - GEM PATHS:
     - /Library/Ruby/Gems/1.8
     - /Users/lina/.gem/ruby/1.8

···

-
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :benchmark => false
     - :backtrace => false
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
     - http://rubygems.org/

Anyone here can help? Thanks in advance.

--
Posted via http://www.ruby-forum.com/.

I end up with manually moving rake from "/opt/local/bin" to "/usr/bin".
And then i create a symbol link using "sudo ln -s /user/bin/ruby
/opt/local/bin/ruby".

Hope this can help others who encounter the same problem:-)

···

--
Posted via http://www.ruby-forum.com/.