Removed MAMP from OS X, dyld still using MAMP libraries - mysql

When I try and use a populator or sphinx on a Ruby app I keep receiving dyld errors. I used to use MAMP on OS X Leopard but since I've upgraded to Snow Leopard and am now using standalone MySQL (10.5 64-bit).
$ rake ts:index
Would return
dyld: Library not loaded: /Applications/MAMP/Library/lib/mysql/libmysqlclient.15.dylib
Referenced from: /usr/local/bin/indexer
Reason: image not found
rake aborted!
Even though to remove MAMP I just deleted the /Applications/MAMP directory. But it still looks like dylib has references to it.
I've tried running:
$ sudo update_dyld_shared_cache -verify
and restarting but the problem still persists.
OS X 10.6.1, MySQL 5.0.85 (x86_64)

http://twitter.com/BouldrMatt fixed it.

Related

Library not loaded: libssl.1.1.dylib (LoadError) when trying to run rails server and connect to mysql

Recently I updated my MacOS to Monterey 12.3 which included updates for xcode.
After that I am not able to run the rails application that I have been working on. I keep getting this error when I try to spin up the server.
I have tried installing and removing mysql different ways. Both using a brew install and DMG file from mysql website.
I am able to access the database instance through my command line but I think they issue is that it I can't connect from application. Anyone else having similar issues?
here is the full error
/Users/gus/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/activesupport-6.0.3.6/lib/active_support/dependencies.rb:324:in `require': dlopen(/Users/gus/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/mysql2-0.5.3/lib/mysql2/mysql2.bundle, 0x0009): Library not loaded: libssl.1.1.dylib (LoadError)
Referenced from: /Users/gus/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/mysql2-0.5.3/lib/mysql2/mysql2.bundle
Reason: tried: 'libssl.1.1.dylib' (no such file), '/usr/local/lib/libssl.1.1.dylib' (no such file), '/usr/lib/libssl.1.1.dylib' (no such file), '/Users/gus/gus_project/Gus2021/libssl.1.1.dylib' (no such file), '/usr/local/lib/libssl.1.1.dylib' (no such file), '/usr/lib/libssl.1.1.dylib' (no such file) - /Users/gus/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/mysql2-0.5.3/lib/mysql2/mysql2.bundle
If anyone runs into this problem, this is what solved my issue.
paths to openssl needed to be updated.
gem install mysql2 -- --with-ldflags=-L/opt/homebrew/opt/openssl#1.1/lib --with-cppflags=-I/opt/homebrew/opt/openssl#1.1/include
bundle install
Obviously this is for openssl install with brew install version 1.1
I was able to get it working with this:
brew install openssl
bundle config build.mysql2 --
--with-ldflags=-L/opt/homebrew/opt/openssl#1.1/lib
--with-cppflags=-I/opt/homebrew/opt/openssl#1.1/include
brew install openssl#1.1
Do all the export path things, and make sure to link openssl#1.1
brew link openssl#1.1 --force
I had similar issue with postgresql, which raises error while running psql -d database:
Library not loaded: '/opt/homebrew/opt/openssl#1.1/lib/libssl.1.1.dylib'
In my case which I have openssl#3 and openssl# the solution is:
brew install openssl#1.1
brew link openssl#1.1 --force
Then reinstall postgresql with homebrew.
I also had my zshrc exporting the following ENV variable though I'm not quite sure if it's related:
export PATH="/opt/homebrew/opt/openssl#1.1/bin:$PATH"
export LDFLAGS="-L/opt/homebrew/opt/openssl#1.1/lib"
export CPPFLAGS="-I/opt/homebrew/opt/openssl#1.1/include"
export PKG_CONFIG_PATH="/opt/homebrew/opt/openssl#1.1/lib/pkgconfig"
For someone who runs into the same issue as mine!

dyld: Library not loaded: /usr/local/opt/openssl/lib/libssl.1.0.0.dylib when running nginx and mysql after macOS upgrade to Catalina

I have updated my development enviroment to the latest version of OSX Catalina. Then nginx and mysql server has stopped working. When I try to run any of these I get the same error:
dyld: Library not loaded: /usr/local/opt/openssl/lib/libssl.1.0.0.dylib
Referenced from: /usr/local/bin/nginx
Reason: image not found
I´m reading a lot of posts and they say mostly the same: Openssl is a dependency library with the new OsX. Fix, looks pretty ease, removed the openssl installation and re-installed the latest version, which is openssl#1.1. I have already done it, but however I´m still getting the same error.
I think it´s because according to the error message, both nginx and mysql are expecting the version 1.0.0 and I´m installing the latest 1.1. I have been trying to install the version 1.0 with homebrew, but I´m not able to find it. Is it possible to get this old version? Or should I upgrade my nginx and mysql software versions?
I had the same issue, not for upgrading to Catalina but because of installing a program which upgrade my version of OpenSSL, so it brokes other apps which depended on OpenSSL.
In my case Ruby (2.3.8 with RVM) and MySQL (MariaDb in fact). In the case of Ruby, it was incompatible with the new version of OpenSSL, so I had to install it with pkg depdendencies for RVM
rvm pkg install openssl
rvm reinstall 2.3.8 --with-openssl-dir=$HOME/.rvm/usr
In the case of MySQL I just upgraded it, so it got installed with the new openSSL on my System.
brew upgrade mariadb
Thats solves my issues. I think in your case you could upgrade (or uninstall and reintall) MySQL and Nginx, so they will correctly use the new version of OpenSSL.
(P.D. In the case of MySQL it conserved my databases without problems)

After running Brew Update, mysql was updated, all rails applications with mysql2 don't work

I have been on this issue for some time now. It happened after I ran brew upgrade. It installed mysql version 5.7.9.
rake aborted!
LoadError: dlopen(/Users/MyName/.rvm/gems/ruby-2.2.3#AppName/extensions/x86_64-darwin-14/2.2.0-static/mysql2-0.3.20/mysql2/mysql2.bundle, 9): Library not loaded: /usr/local/opt/mysql/lib/libmysqlclient.18.dylib
Referenced from: /Users/MyName/.rvm/gems/ruby-2.2.3#AppName/extensions/x86_64-darwin-14/2.2.0-static/mysql2-0.3.20/mysql2/mysql2.bundle
Reason: image not found - /Users/MyName/.rvm/gems/ruby-2.2.3#AppName/extensions/x86_64-darwin-14/2.2.0-static/mysql2-0.3.20/mysql2/mysql2.bundle
but when I cd into the directory
opt/mysql/lib master ✔ 3h36m
▶ ls
libmysqlclient.18.dylib libmysqlclient.20.dylib libmysqlclient.a libmysqlclient.dylib libmysqld.a libmysqlservices.a pkgconfig plugin
I tried all the symlink answers on this forum but still no luck. I am running El Capitan. I also did locate and this was the result:
opt/mysql/lib master ✔ 3h36m
▶ locate libmysqlclient.18.dylib
/usr/local/Cellar/mysql/5.6.27/lib/libmysqlclient.18.dylib
/usr/local/lib/libmysqlclient.18.dylib
The gem mysql2 is not working for any of my rails applications. Everytime I run rails s, or any rake task it automatically fails. Running rails s gives this error:
▶ rails s
bin/rails:6: warning: already initialized constant APP_PATH
Any help is GREATLY appreciated. Please and thank you.
so I wanted to make sure this was there for others with this problem. Wajid Kagzi's comment was the fix for my issue as well.
I fixed it by reinstalling mysql from brew, then uninstalled and reinstalled the mysql2 gem from each of my versions of ruby.

Rails/Mysql2/Lion [FATAL] failed to allocate memory

I seem to be getting this issue when trying to run a Rails 3.x site with POW using the mysql2 gem and on OSX Lion.
[FATAL] failed to allocate memory
Also I am running Rails 2.x apps successfully with the same setup under POW.
I'm assuming this is an issue related to Lion + MySQL2 as other errors seem to indicate this to be the source but I can't seem to locate the issue.
Any ideas?
I had the same problem when I used to mysql-connector-c & mysql. The problem was in mysql-connector-c which had old dylib. So problem resolved by removing mysql-connector-c, the next you have to change shell variable DYLD_LIBRARY_PATH or make symbol link for libmysqlclient.18.dylib. You should reinstall mysql2 gem after this.
To change DYLD_LIBRARY_PATH insert export DYLD_LIBRARY_PATH=/usr/local/Cellar/mysql/5.5.20/lib/:$DYLD_LIBRARY_PATH in your ~/.baschrc and reload shell
To make symbol link for libmysqlclient.18.dylib evaluate in your shell this command:
ln -s /usr/local/Cellar/mysql/5.5.20/lib/libmysqlclient.18.dylib /usr/local/lib/
I used here directory where my mysql installed. Change it to your's if you have another mysql location.
This turned out to be a problem with node (installed using Homebrew) for me.
So I uninstalled and reinstalled node using Homebrew
first:
brew uninstall node
then:
brew install node

mysql gem looking for an earlier version of libmysqlclient.16.dylib

I just upgraded to Mac OSX Snow Leopard, and recompiled mysql (5.1.39) with the Snow Leopard XCode. I also reinstalled the latest mysql gem.
Now, when running
rake db:migrate
in a rails app, I get
dyld: NSLinkModule() error
dyld: Library not loaded: /usr/local/mysql/lib/libmysqlclient.15.dylib
Referenced from: /usr/local/lib/ruby/gems/1.8/gems/mysql-2.7/lib/mysql.bundle
Reason: image not found
Trace/BPT trap
I have /usr/local/mysql/lib/libmysqlclient.16.dylib, but not ...15.dylib.
Do I need to use an earlier version of mysql?
No it almost looks like you need to remove the mysql gem and then re-install it using
gem install mysql -- --with-mysql-dir=/path/to/mysql_dir (sometimes /usr/local/mysql)
Try hammering in which version of mysql for the gem to use:
gem install mysql -- --with-mysql-config=/path/to/mysql_config
Thanks for the help!
I ended up removing mysql completely:
http://akrabat.com/2008/09/11/uninstalling-mysql-on-mac-os-x-leopard/
Then compiling and installing the following to /usr/local:
readline 6.0
ruby 1.8.7
rubygems
With help from
http://hivelogic.com/articles/compiling-ruby-rubygems-and-rails-on-snow-leopard