Then we use that process_id in a magical program called ‘lsof’: Top will return a list of all process names and their process ids.
Now find the process_id for ruby by running ‘top’ in the command line. Do something within your site that you know touches the database. If you have a rails project, start with webrick (script/server) and load up your test site in a browser. Now that you’ve got the mysql C bindings for ruby installed, lets double check that it’s actually being used. Replace with valid credentials for your MySQL server and you should have a fairly successful run of the unit tests for the mysql ruby gem. To run the unit tests for the mysql ruby gem you need to supply some command line arguments to test.rb: Sudo install_name_tool -change /usr/local/mysql/lib/mysql/libmysqlclient.15.dylib /usr/local/mysql/lib/libmysqlclient.15.dylib /Library/Ruby/Gems/1.8/gems/mysql-2.7/mysql.bundle This bundle file is used by the unit test file test.rb. Run the fix again in the main mysql ruby gem directory as there is another mysql.bundle file that needs fixing.
On OS X Leopard, ruby gems are installed in the /Library directory rather than /usr/local/lib. The only difference between jhclouse’s fix and the one here is the location of the installed mysql rubygem. Sudo install_name_tool -change /usr/local/mysql/lib/mysql/libmysqlclient.15.dylib /usr/local/mysql/lib/libmysqlclient.15.dylib /Library/Ruby/Gems/1.8/gems/mysql-2.7/lib/mysql.bundle
#Mysql on mac problem mac os x
I’ve edited the fix to work with Mac OS X Leopard’s pre-installed version of Ruby: The fix to the mysql ruby library gem installation was provided by jhclouse on the RailsForum site. Referenced from: /Library/Ruby/Gems/1.8/gems/mysql-2.7/mysql.bundle mysql.bundle: dlopen(./mysql.bundle, 9): Library not loaded: /usr/local/mysql/lib/mysql/libmysqlclient.15.dylib (LoadError)
#Mysql on mac problem install
Or perhaps you’ve tried to run test.rb from the mysql ruby library install and ran into an error like this: Reason: image not found - /Library/Ruby/Gems/1.8/gems/mysql-2.7/lib/mysql.bundleįrom /Library/Ruby/Gems/1.8/gems/mysql-2.7/lib/mysql.bundleįrom /System/Library/Frameworks/amework/Versions/1.8/usr/lib/ruby/1.8/rubygems/custom_require.rb:32:in `require'
Referenced from: /Library/Ruby/Gems/1.8/gems/mysql-2.7/lib/mysql.bundle LoadError: dlopen(/Library/Ruby/Gems/1.8/gems/mysql-2.7/lib/mysql.bundle, 9): Library not loaded: /usr/local/mysql/lib/mysql/libmysqlclient.15.dylib For those of you using MySQL database server on Mac OS X Leopard while developing for Ruby or Ruby on Rails, you might have run into an issue with the mysql rubygem installing OK, but not actually loading properly in irb, nor completing unit tests successfully.