I was having an issue trying to start a ruby 2.3.1 rails 4.2.8 application with bundle exec rails s where i was getting:
activesupport-4.2.8/lib/active_support/dependencies.rb:274:in `require': dlopen(.rvm/gems/ruby-2.3.1/gems/curb-0.8.8/lib/curb_core.bundle, 9): Library not loaded: #rpath/libcurl.4.dylib (LoadError)
Referenced from: .rvm/gems/ruby-2.3.1/gems/curb-0.8.8/lib/curb_core.bundle
The problem seems to be that the provided gem through bundle install was originally compiled against a newer version of curl than the one that comes with OSX.
One possible solution would be to install a newer version of curl using brew brew install curl and then link it as the system default brew link curl however that would replace the default OSX curl with the newer one and could cause system problems (or other compiled software could be expecting the default osx version of the libraries)
So the best solution is to install curl with brew without linking it brew install curl and then reinstall curb gem linking it to the brew curl libraries:
gem install curb -v 0.8.8 -- --with-ldflags=-L/usr/local/opt/curl/lib --with-cppflags=-I/usr/local/opt/curl/include
This approach worked fine for me and I decided to include it here to save time in case anyone else comes across the same issue I had
I had this problem as well because which curl returned /opt/anaconda3/bin/curl.
To fix this, I ran
conda remove curl
Then I could
gem install curb
I've run into this problem after I installed the newest version of the heroku toolbelt.
If I use the heroku command, I get this error:
$ heroku -v
dyld: lazy symbol binding failed: Symbol not found: _ruby_run
Referenced from: /usr/local/bin/ruby
Expected in: /usr/lib/libruby.dylib
dyld: Symbol not found: _ruby_run
Referenced from: /usr/local/bin/ruby
Expected in: /usr/lib/libruby.dylib
Trace/BPT trap: 5
I'm running on OSX 10.9.1 with ruby 2.1.1p76 and Rails 4.0.3 with RVM. I've reinstalled rvm, home-brew, updated ruby from 2.0.0. And started using postgresql 9.3 for development. I use postgresql 9.3 for development.
I had the same problem, which prevented me from using Rails or Heroku. Changing my PATH did nothing.
My solution was to remove Ruby from /usr/local/bin and /usr/local/lib. Specifically, I renamed /usr/local/bin/ruby to /usr/local/bin/rubyOLD and renamed the /usr/local/lib/ruby directory to /usr/local/lib/rubyOLD.
Since heroku was also installed in /usr/local and it was referring to the /usr/local ruby, I renamed /usr/local/bin/heroku to /usr/local/bin/herokuOLD and reinstalled via the Heroku Toolbelt.
I also reinstalled rvm for good measure (rvm implode completely removes rvm from your system, and the rvm website website explains how to reinstall it).
It looks like you have a newer ruby version in /usr/local and an older one in /usr. The shared library from the older one is being linked to the binary from the new one at runtime.
Adjust your DYLD_LIBRARY_PATH so that /usr/local/lib is before /usr/lib, so the libruby.dylib in /usr/local/lib is found and preferred by the linker. Or use install_name_tool to modify the library path on /usr/local/bin/ruby directly.
If I run some kind of rake command, I get this error message:
rake aborted!
dlopen(/Users/adam/.rvm/gems/ruby-1.9.3-p327/gems/rmagick-2.13.1/lib/RMagick2.bundle, 9): Library not loaded: /usr/local/lib/libfreetype.6.dylib
Referenced from: /usr/local/lib/libMagickCore-Q16.7.dylib
Reason: Incompatible library version: libMagickCore-Q16.7.dylib requires version 16.0.0 or later, but libfreetype.6.dylib provides version 13.0.0 - /Users/adam/.rvm/gems/ruby-1.9.3-p327/gems/rmagick-2.13.1/lib/RMagick2.bundle
...
I am running on RoR 3.2, OSX Lion.
Could anyone help me, please, how to fix this issue? I spent 2 days of googling, reading discussions, but unfortunately with zero success...
Thank you so much!
Using Homebrew I was able to solve it using the following commands:
brew uninstall freetype
brew update
brew install freetype
Update step might be unnecessary. The installation succeeded but with the following warning:
Warning: Could not link freetype. Unlinking...
So one final command:
brew link --overwrite freetype
I have an amazing how-to-install-rmagick that have been working beautifully for me, try to re-install ImageMagick following these steps:
yum install tcl-devel libpng-devel libjpeg-devel ghostscript-devel bzip2-devel freetype-devel libtiff-devel -y (I use CentOS, you can translate the commands to your distro)
Download ImageMagick. Write wget ftp://ftp.imagemagick.org/pub/ImageMagick/ImageMagick.tar.gz and press Enter. ImageMagick.tar.gz is created in the current directory.
Unpack the ImageMagick archive. Write tar xczf ImageMagick.tar.gz and press Enter. A new directory, ImageMagick-version, where version is the ImageMagick version number, is created.
Switch to the ImageMagick directory. Write cd ImageMagick-version and press Enter.
Configure the ImageMagick build. Write ./configure --prefix=/usr/local --without-perl and press Enter.
Compile ImageMagick. Write make and press Enter. ImageMagick compiles. This step may take several minutes.
Install ImageMagick to your home directory. Write make install and press Enter.
Remove the installation files. Write rm -r ImageMagick.tar.gz and press Enter.
Add /usr/local/bin to your PATH.
Write echo export PATH="/usr/local/bin:$PATH" >> ~/.bash_profile and press Enter.
Reload your .bash_profile. Write source ~/.bash_profile and press Enter.
Install the RMagick gem.
Write export LD_LIBRARY_PATH=/usr/local/lib and press Enter.
Write export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig/ and press Enter.
Install the RMagick gem in your Ruby on Rails application.
Tell me later how it goes.
I found the answer in another post:
Rails 3 - RMagick doesn't find libfreetype.6.dylib using Paperclip
I performed the search and found that there was an older version of libfreetype that was being referenced and newer versions hidden elsewhere. By copying/linking the newer versions into the appropriate directory (/usr/local/lib in my case) the problem was resolved.
Do you use something like Homebrew or MacPorts to manage external library dependencies?
Installing the imagemagick library from there and then install rmagick.
After installing the pg gem, I'm getting this error when I try to start the server on my local machine:
/Users/foo/.rvm/gems/ree-1.8.7-2011.12/gems/pg-0.14.0/lib/pg_ext.bundle: dlopen(/Users/foo/.rvm/gems/ree-1.8.7-2011.12/gems/pg-0.14.0/lib/pg_ext.bundle, 9): Library not loaded: #loader_path/../lib/libssl.dylib (LoadError)
Referenced from: /usr/lib/libpq.5.dylib
Reason: Incompatible library version: libpq.5.dylib requires version 1.0.0 or later, but libssl.dylib provides version 0.9.8 - /Users/foo/.rvm/gems/ree-1.8.7-2011.12/gems/pg-0.14.0/lib/pg_ext.bundle
I have an up to date version of openssl installed on my machine via macports but it seems like the gem is looking at the older version that I have installed in /usr/lib for some reason (maybe something to do with a messed up #loader_path?).
'openssl version' gives me 'OpenSSL 1.0.1c 10 May 2012'
and 'which openssl' gives me '/opt/local/bin/openssl' as I expected
Any help is really appreciated. Thanks!
I just ran into this problem after updating to Mountain Lion. After checking that I had a proper OpenSSL version, I did the following.
$ ls /Library/PostgreSQL/9.1/lib/libssl*
Provided the following:
/Library/PostgreSQL/9.1/lib/libssl.1.0.0.dylib
/Library/PostgreSQL/9.1/lib/libssl.dylib
/Library/PostgreSQL/9.1/lib/libssl.a
I copied the file as so:
$ sudo cp /Library/PostgreSQL/9.1/lib/libssl.1.0.0.dylib /usr/lib/
Then linked:
$ cd /usr/lib
$ ln -sf libssl.1.0.0.dylib libssl.dylib
After that, I tried rails s again and the same error came up with a different file, so I repeated the process (libcrypto):
requires version 1.0.0 or later, but libcrypto.0.9.8.dylib
provides version 0.9.8
so:
$ sudo cp /Library/PostgreSQL/9.1/lib/libcrypto.1.0.0.dylib /usr/lib/
$ cd /usr/lib
$ ln -sf libcrypto.1.0.0.dylib libcrypto.dylib
See this question's answers for reference as well:
python pip install psycopg2 install error
I just upgraded to Rails 3 and had a bit of a mess with MacPorts, gems and databases to sort out. I threw out all the gems and installed them fresh. Everything seems to be OK except for the requirement of the pg gem.
After creating a new Rails 3 project, prepared for PostgreSQL, the server would not start, complaining about the missing pg gem. Doing bundle install, it chugged along for a while and, of course, fails on the pg gem.
Installing pg (0.10.0) with native extensions /Library/Ruby/Site/1.8/rubygems/installer.rb:483:in `build_extensions': ERROR: Failed to build gem native extension. (Gem::Installer::ExtensionBuildError)
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb
mkmf.rb can't find header files for ruby at /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/ruby.h
Gem files will remain installed in /Library/Ruby/Gems/1.8/gems/pg-0.10.0 for inspection.
Results logged to /Library/Ruby/Gems/1.8/gems/pg-0.10.0/ext/gem_make.out
from /Library/Ruby/Site/1.8/rubygems/installer.rb:446:in `each'
from /Library/Ruby/Site/1.8/rubygems/installer.rb:446:in `build_extensions'
from /Library/Ruby/Site/1.8/rubygems/installer.rb:198:in `install'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.7/lib/bundler/source.rb:95:in `install'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.7/lib/bundler/installer.rb:55:in `run'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.7/lib/bundler/spec_set.rb:12:in `each'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.7/lib/bundler/spec_set.rb:12:in `each'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.7/lib/bundler/installer.rb:44:in `run'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.7/lib/bundler/installer.rb:8:in `install'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.7/lib/bundler/cli.rb:225:in `install'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.7/lib/bundler/vendor/thor/task.rb:22:in `send'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.7/lib/bundler/vendor/thor/task.rb:22:in `run'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.7/lib/bundler/vendor/thor/invocation.rb:118:in `invoke_task'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.7/lib/bundler/vendor/thor.rb:246:in `dispatch'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.7/lib/bundler/vendor/thor/base.rb:389:in `start'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.7/bin/bundle:13
from /usr/bin/bundle:19:in `load'
from /usr/bin/bundle:19
The most common suggestion I have found on forums and blogs is to (re)install the XCode developer tools. They were already there, but I reinstalled them anyway, with no better outcome than the above.
which ruby says /usr/bin/ruby, and ruby -v says ruby 1.8.7 (2009-06-12 patchlevel 174) [universal-darwin10.0], if there's any clue there.
Pointers are welcome. Any missing information that would help figuring this out, I'll gladly and promptly provide!
I downloaded XCode since the DVD version is said to be broken and things went better for a while. bundle install started talking about "archflags" instead, so I did:
sudo env ARCHFLAGS="-arch i386" bundle install
and things seemed to go fine, until starting Rails barfed, saying:
/Library/Ruby/Gems/1.8/gems/pg-0.10.0/lib/pg_ext.bundle: dlopen(/Library/Ruby/Gems/1.8/gems/pg-0.10.0/lib/pg_ext.bundle, 9): no suitable image found. Did find: (LoadError)
/Library/Ruby/Gems/1.8/gems/pg-0.10.0/lib/pg_ext.bundle: mach-o, but wrong architecture - /Library/Ruby/Gems/1.8/gems/pg-0.10.0/lib/pg_ext.bundle
Grappling for anything, I tried bundle install with archflags set to -arch x86_64, but it didn't go well:
*** Your PostgreSQL installation doesn't seem to have an architecture in common with the running ruby interpreter ([] vs. ["x86_64"])
I'll continue anyway, but if it fails, try setting ARCHFLAGS.
[...]
Can't find the PostgreSQL client library (libpq)
*** extconf.rb failed ***
Is libpq something I now have to supply a path to via some flags? Or am I completely out to lunch?
I encountered this error when I tried to install rails by gem on CentOS 6.3.
After googling a bit, I found a quick fix: installing the ruby-devel package.
sudo yum install ruby-devel
After that, everything worked fine.
Generally the gem bundles for Postgres want to know where pg_config is hiding so they can ask about the Postgres installation.
Use locate pg_config to see if your Mac knows where it's hiding.
I installed a copy of Postgres using mappstack, so my Mac says there's a copy at:
/Applications/mappstack-1.2-3/postgresql/bin/pg_config
and another at:
/Library/PostgreSQL/9.0/bin/pg_config
I don't remember installing the one at /Library/PostgreSQL/9.0, so it might have been preinstalled by Snow Leopard, or I did it when under the influence of too much work, possibly using the Postgres installer from EnterpriseDB.
Once you've found the location of pg_config try adding that directory to the start of your PATH and then rerun the gem install.
Or use:
export SQL_PATH=/Library/PostgreSQL/9.0
gem install pg -- --with-pg-config=$SQL_PATH/bin/pg_config
and try installing. If either of those work you're done. Otherwise...
The next thing the installers might want are access to the Postgres headers, so you look in the parent of the bin directories, and see if you can find an include directory.
After that, look in that directory for a lib directory. Once you know those locations you should have all you need to set your environment variables to let the installer complete. You'll need to read the README or INSTALL file of the installer and see what needs to be set up. You'll be configuring:
export include_dir=$SQL_PATH/include/
export lib_dir=$SQL_PATH/lib/
gem install pg -- --with-pgsql-include-dir=$include_dir --with-pgsql-lib-dir=$lib_dir
Hopefully that'll all help. I have Rails 3 and my Postgres running fine, using the mappstack Postgres and the EnterpriseDB versions, so the above info should get you there.
This worked for me on OS X 10.6.6, with PostgreSQL 9.0.1 installed from the source code:
export PATH=/usr/local/psql/bin:$PATH
export ARCHFLAGS='-arch x86_64'
gem install pg
You'll likely need to edit that PATH to match your postgres install location.
I've got postgres 1.9.0 installed via macports. OS X 10.5 PPC
This worked for me:
gem install pg -- --with-pg-lib=/opt/local/lib/postgresql90 --with-pg-include=/opt/local/include/postgresql90
Good luck!
Generally the gem bundles for Postgres want to know where pg_config is hiding . . .
Right - this could be the trick. If you just installed PostgreSQL and added it to your path, and did "bundle install" in an old shell, it won't be able to find pg_config. If that's the case, just get a new shell and try again. Otherwise, follow the steps above to find it and get it seen by bundler.
The macports install for postgresql83 works fine and plays nicely with rails right out of the box - that's another way to do it.
I just spent a good deal of time getting this to work tonight. I saw a similar error to this:
Can't find the PostgreSQL client library (libpq)
*** extconf.rb failed ***
I tried different gem install variations:
gem install pg -- --with-pg-config=/Library/PostgreSQL/9.1/bin/ --with-pg-lib=/Library/PostgreSQL/9.1/lib/ --with-pg-include=/Library/PostgreSQL/9.1/include/
But finally what worked for me was:
gem install pg -- --with-pg-dir=/Library/PostgreSQL/9.1/
Also, before that I updated rvm (rvm get head) and reinstalled ruby (rvm --force install 1.9.2). Not sure if this helped or not, but it might be worth trying if you still hit issues
You might want to try going with homebrew for installing postgres (brew install postgres) and Ruby Version Manager for installing and maintaining ruby and ruby gems.
It'll leave your default versions (installed with OSX) untouched and give you more flexibility. For example, you could have different rails apps using rails 2 or 3 with ruby 1.8.7 and 1.9.2 all installed on the same system without problems.
This worked for me:
sudo env ARCHFLAGS="-arch x86_64" gem install pg
All the suggestions here and around the Web were incomplete for me, until I run the following on CentOS 6.6:
wget -c ftp://mirror.switch.ch/pool/4/mirror/scientificlinux/6.3/x86_64/updates/security/kernel-devel-2.6.32-504.1.3.el6.x86_64.rpm && sudo yum install kernel-devel-2.6.32-504.1.3.el6.x86_64.rpm
wget -c ftp://mirror.switch.ch/pool/4/mirror/scientificlinux/6.6/x86_64/updates/security/kernel-headers-2.6.32-504.30.3.el6.x86_64.rpm && sudo yum install kernel-headers-2.6.32-504.30.3.el6.x86_64.rpm
sudo yum groupinstall "Development Tools" "Development Libraries"
sudo yum -y install gcc gcc-c++ git ruby ruby-devel rubygems libvirt-devel mysql-devel postgresql-devel openssl-devel libxml2-devel sqlite-devel libxslt-devel zlib-devel readline-devel tar make automake autoconf curl-devel openssl-devel zlib-devel httpd-devel apr-devel apr-util-devel sqlite-devel ruby193-ruby-doc ruby193-ruby-devel ruby193-build
curl -L get.rvm.io | bash -s stable && source $HOME/.rvm/scripts/rvm && rvm requirements
Install Postgres.app:
http://postgresapp.com/
Verify what version was installed:
$ ls /Library/PostgreSQL/
# 9.4
Export the SQL_PATH:
export SQL_PATH=/Library/PostgreSQL/9.4
Install pg:
gem install pg -- --with-pg-config=$SQL_PATH/bin/pg_config