Search code examples
ruby-on-railsmacosterminalrakemacports

How do I change the directory of Rake? (currently /usr/bin/rake)


I am using Ruby 1.8.7 and Rails 3 on OS X. I'm getting an error when I run rake db:create on a new installation of rails for the first time. Here is the error in Terminal:

(in /Users/Michael/Sites/rails/blog)
rake aborted!
undefined local variable or method `bundler' for main:Object
/Users/Michael/Sites/rails/blog/Rakefile:4

Using which commands I get:

$ which ruby
/opt/local/bin/ruby
$ which rake
/usr/bin/rake

I installed ruby using MacPorts, hence the opt/ path. How do I change rake's config to go to that path instead of /usr/bin/rake?


Solution

  • you could try to change the PATH env variable so that the /opt/local/bin is prepended to the /usr/bin. For instance in your $HOME/.bash_profile file you could write

    export PATH=/opt/local/bin:$PATH