bad interpreter: No such file or directory when running rake

522 views
Skip to first unread message

Devin McCabe

unread,
Jan 10, 2010, 4:20:18 PM1/10/10
to rubyonra...@googlegroups.com
After upgrading to Snow Leopard, I found my rails and mysql installs to
be completely hosed, so I uninstalled ruby, mysql, and rubygems and
reinstalled them from these instructions:
http://hivelogic.com/articles/compiling-ruby-rubygems-and-rails-on-snow-leopard/

Here's where things are installed now:

$ which ruby
/usr/local/bin/ruby
$ which rails
/usr/local/bin/rails
$ which gem
/usr/local/bin/gem
$ which rake
/usr/bin/rake
$ which mysql
/usr/local/mysql/bin/mysql

My problem is that if I try to run rake db:migrate (or anything with
rake), I get this error:

$ rake db:migrate
-bash: /usr/bin/rake:
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby: bad
interpreter: No such file or directory

My .bash_profile is a mess due to many hours of unsuccessful
troubleshooting:

$ echo $PATH
/~/.gem:/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:/opt/local/bin:/opt/local/sbin:/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:/usr/local/lib/ruby/gems/1.8/bin/:/opt/local/bin:/opt/local/sbin:/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:/usr/local/bin:/opt/local/bin:/opt/local/sbin:/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:/usr/local/bin:/usr/local/bin:/usr/local/sbin:/bin:/sbin:/usr/bin:/usr/sbin:/opt/local/bin:/opt/local/sbin:/Users/devin/.gem/ruby/1.8/bin

How do I reset my profile to get rake (and everything else) working
properly.
--
Posted via http://www.ruby-forum.com/.

Devin McCabe

unread,
Jan 10, 2010, 5:21:55 PM1/10/10
to rubyonra...@googlegroups.com
OK, I was somehow able to resolve this error by reinstalling both rake
and rails. Now I get a different error:

$ rake db:migrate
(in /Users/devin/Sites/test)
dyld: lazy symbol binding failed: Symbol not found: _mysql_init
Referenced from:
/usr/local/lib/ruby/gems/1.8/gems/mysql-2.8.1/lib/mysql_api.bundle
Expected in: flat namespace

dyld: Symbol not found: _mysql_init
Referenced from:
/usr/local/lib/ruby/gems/1.8/gems/mysql-2.8.1/lib/mysql_api.bundle
Expected in: flat namespace

Trace/BPT trap

-------------

MySQL does work fine, but rails isn't seeing it:

irb(main):001:0> require 'mysql'
LoadError: no such file to load -- mysql
from (irb):1:in `require'
from (irb):1

Conrad Taylor

unread,
Jan 10, 2010, 6:41:19 PM1/10/10
to rubyonra...@googlegroups.com
In the above, you haven't loaded the Rails environment.  You'll have to
navigate to the root of a Rails application and perform the following
action:

script/console

Next, if you're upgrading to Snow Leopard, then I would recommending
reading the following:


However, I would recommend installing MySQL database server via MacPorts 
because the maintainer keeps this port relatively current:

a) install the latest version of MacPorts


b) update your PATH environment variable in .profile to look like the following:

    export PATH=/opt/local/bin:/opt/local/sbin:${PATH}

c) open up a new terminal window

d) install the MySQL5 database server

    sudo port install mysql5-server

    Note:  Please following the instructions that appear on the screen for post installation.

e) configure RubyGems

    sudo gem update --system

f) install some basic gems

   sudo gem install rails mysql sqlite3-ruby rack

Good luck,

-Conrad

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonra...@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-ta...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.




Reply all
Reply to author
Forward
0 new messages