Posts filed under ‘Ruby’
Instalando a gem do PostgreSQL no Rails 3
Recentemente, após instalar o dmg do PostgreSQL 9.1, fui usar a gem pg (gem do Postgres) e tomei uns erros estranhos:
checking for pg_config... no
No pg_config... trying anyway. If building fails, please try again with
--with-pg-config=/path/to/pg_config
checking for libpq-fe.h... no
Can't find the 'libpq-fe.h header
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/Users/hannelitavante/.rvm/rubies/ruby-1.9.2-p180/bin/ruby
--with-pg
--without-pg
--with-pg-dir
--without-pg-dir
--with-pg-include
--without-pg-include=${pg-dir}/include
--with-pg-lib
--without-pg-lib=${pg-dir}/lib
--with-pg-config
--without-pg-config
--with-pg_config
--without-pg_config
Gem files will remain installed in /Users/hannelitavante/.rvm/gems/ruby-1.9.2-p180/gems/pg-0.11.0 for inspection.
Bizarramente, no MacOSX 10.6+, ele dá uns paus muito loucos. para resolver, basta fazer isso:
export PATH=PATH_DO_SEU_POSTGRES/bin:$PATH export ARCHFLAGS='-arch x86_64' gem install pg
Resolvendo o problema da gem mysql2 no Mac OSX
Olá, pessoal!
Muita gente tem me perguntado sobre um problema na gem mysql2 no Mac OSX. Ao rodar um bundle install utilizando rvm, aparentemente algumas libs não são encontradas, ocasionando um log como este:
/usr/local/ruby/lib/ruby/gems/1.9.1/gems/mysql2-0.2.6/lib/mysql2/mysql2.bundle Reason: image not found - /usr/local/ruby/lib/ruby/gems/1.9.1/gems/mysql2-0.2.6/lib/mysql2/mysql2.bundle
É bem simples de resolver issto. Basta rodar
sudo install_name_tool -change libmysqlclient.18.dylib /usr/local/mysql/lib/libmysqlclient.18.dylib /Users/*seu_user*/.rvm/gems/ruby-1.9.2-p180/gems/mysql2-0.2.6/lib/mysql2/mysql2.bundle</span>
Apenas troque “/Users/*seu_user*/.rvm/gems/ruby-1.9.2-p180/gems/mysql2-0.2.6/lib/mysql2/mysql2.bundle” pelo local onde apontar o erro.