Install dm-postgres-adapter on Mac - ruby

I've been fighting on this for two days, time to ask to StackOverflow.
I've prepared a simple Ruby app (noob alert!) to start with this language. I've used Sinatra and DataMapper.
When using MySql everything went fine. I've installed the dm-mysql-adapter and then with a rake migrate the tables where automagically created.
I tried to change mysql over postgres (to publish the app on Heroku) and now the problem.
Launching this command:
sudo gem install dm-postgres-adapter
will give:
Building native extensions. This could take a while...
ERROR: Error installing dm-postgres-adapter:
ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby extconf.rb
checking for main() in -lpq... yes
checking for libpq-fe.h... yes
checking for libpq/libpq-fs.h... yes
checking for postgres.h... yes
checking for mb/pg_wchar.h... no
*** 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=/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby
--with-pgsql-server-dir
--without-pgsql-server-dir
--with-pgsql-server-include
--without-pgsql-server-include=${pgsql-server-dir}/include
--with-pgsql-server-lib
--without-pgsql-server-lib=${pgsql-server-dir}/
--with-pgsql-client-dir
--without-pgsql-client-dir
--with-pgsql-client-include
--without-pgsql-client-include=${pgsql-client-dir}/include
--with-pgsql-client-lib
--without-pgsql-client-lib=${pgsql-client-dir}/
--with-pqlib
--without-pqlib
Could not find PostgreSQL build environment (libraries & headers): Makefile not created
I've tried to uninstall and reinstall Postgres (through homebrew) and also passing to the gem install some of those parameters, for example:
sudo gem install dm-postgres-adapter -- --with-pgsql-server-dir=/usr/local/Cellar/postgresql/9.3.2/
sudo gem install dm-postgres-adapter -- --with-pgsql-server-dir=/usr/local/Cellar/postgresql/9.3.2/include/server/
sudo gem install dm-postgres-adapter -- --with-pgsql-server-include=/usr/local/Cellar/postgresql/9.3.2/include/
Any help on this?

Related

Installing Ruby Gem Not working on OSX 10.10 Yosemite

I am trying to install Github Linguist ruby gem through terminal in Mac .
I don't have enough points to upload image so please bear with me.
This is error it is showing when I install it in terminal :-
bash-3.2# gem install github-linguist
Building native extensions. This could take a while...
ERROR: Error installing github-linguist:
ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby -r ./siteconf20150321-444-15aw05d.rb extconf.rb
checking for gmake... no
checking for make... yes
checking for cmake... no
ERROR: CMake is required to build Rugged.
* 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=/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby
--use-system-libraries
extconf failed, exit code 1
Gem files will remain installed in /Library/Ruby/Gems/2.0.0/gems/rugged-0.22.1b1 for inspection.
Results logged to /Library/Ruby/Gems/2.0.0/extensions/universal-darwin-14/2.0.0/rugged-0.22.1b1/gem_make.out
brew install cmake should do the trick
I know you are not asking how to manager Ruby's versions.
but starting to use RVM will help a lot.

Gem install pg works but bundle install fails

There is very lot of topics about this but I already try almost all of them with no success.
I'm on Mac OS X 10.9.4 Mavericks, I have the Postgres.app, and it seams to work fine, sudo gem install pg works too :
Building native extensions. This could take a while...
Successfully installed pg-0.17.1
invalid options: -f fivefish
(invalid options are ignored)
Parsing documentation for pg-0.17.1
Done installing documentation for pg after 2 seconds
1 gem installed
but when I try to bundle install I have the same error than every one else.
I already try bundle config build.pg --with-pg-config=/Applications/Postgres.app/Contents/Versions/9.3/bin/pg_config
then bundle install
I have the Xcode Command Line Tools.
which psqlreturn /Applications/Postgres.app/Contents/Versions/9.3/bin/psql
which postgresreturn /Applications/Postgres.app/Contents/Versions/9.3/bin/postgres
Here is the error for bundle install:
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby extconf.rb --with-pg-config=/Applications/Postgres.app/Contents/Versions/9.3/bin/pg_config
Using config values from /Applications/Postgres.app/Contents/Versions/9.3/bin/pg_config
checking for libpq-fe.h... yes
checking for libpq/libpq-fs.h... yes
checking for pg_config_manual.h... yes
checking for PQconnectdb() in -lpq... no
checking for PQconnectdb() in -llibpq... no
checking for PQconnectdb() in -lms/libpq... no
Can't find the PostgreSQL client library (libpq)
*** 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=/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby
--with-pg
--without-pg
--with-pg-config
--with-pg-dir
--without-pg-dir
--with-pg-include
--without-pg-include=${pg-dir}/include
--with-pg-lib
--without-pg-lib=${pg-dir}/
--with-pqlib
--without-pqlib
--with-libpqlib
--without-libpqlib
--with-ms/libpqlib
--without-ms/libpqlib
extconf failed, exit code 1
Gem files will remain installed in /var/folders/07/my1cl5xj7g9cknnp3y2zg_rh0000gn/T/bundler20140723-29399-1o0uzqn/pg-0.17.1/gems/pg-0.17.1 for inspection.
Results logged to /var/folders/07/my1cl5xj7g9cknnp3y2zg_rh0000gn/T/bundler20140723-29399-1o0uzqn/pg-0.17.1/extensions/universal-darwin-13/2.0.0/pg-0.17.1/gem_make.out
An error occurred while installing pg (0.17.1), and Bundler cannot continue.
Make sure that `gem install pg -v '0.17.1'` succeeds before bundling.
After days I finally found the problem source (ironically when I decide to give up, and move on).
When I do a
which bundle and which gem
They were not from the same ruby installation.
bundle was from rbenv and gem from the preinstalled ruby on mac osx.
might have the permission issue. can use:
sudo bundle install --without nothing --path vendor/cache

Running id3lib-ruby on Heroku

I'm attempting to resurrect some old code which used id3lib-ruby and id3lib to run on Heroku and am not having any luck with it - can someone tell me if its supported? I know that the id3lib-ruby gem itself is no longer supported, but just wondering if I can run it on Heroku?
Here is the error I'm getting:
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/tmp/build_3287hfmgqe8t8/vendor/ruby-2.0.0/bin/ruby extconf.rb
checking for main() in -lstdc++... yes
checking for main() in -lz... yes
checking for main() in -liconv... no
checking for id3.h... no
You must have id3lib installed in order to use id3lib-ruby.
*** 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
--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=/tmp/build_3287hfmgqe8t8/vendor/ruby-2.0.0/bin/ruby
--with-stdc++lib
--without-stdc++lib
--with-zlib
--without-zlib
--with-iconvlib
--without-iconvlib
Gem files will remain installed in /tmp/build_3287hfmgqe8t8/vendor/bundle/ruby/2.0.0/gems/id3lib-ruby-0.6.0 for inspection.
Results logged to /tmp/build_3287hfmgqe8t8/vendor/bundle/ruby/2.0.0/gems/id3lib-ruby-0.6.0/ext/id3lib_api/gem_make.out
An error occurred while installing id3lib-ruby (0.6.0), and Bundler cannot
continue.
Make sure that `gem install id3lib-ruby -v '0.6.0'` succeeds before bundling.
Failed to install gems via Bundler.
Push rejected, failed to compile Ruby/Rails app
Does anyone have any ideas?
Thanks...Chris
4 months late but...
The error is because id3lib-ruby requires the id3lib header and library files to be available in order to be successfully installed (as the error says, it builds a native extension). Heroku doesn't have these available by default, so you have to install them with a buildpack (https://devcenter.heroku.com/articles/buildpacks).
I was just in the same boat so I wrote a Heroku buildpack to install id3lib which can be composed (using heroku-buildpack-multi) with their ruby buildpack to allow id3lib-ruby to be built: https://github.com/benalavi/buildpack-id3lib

Can't install mysql gem on OS X 10.6 Snow Leopard Server

Having trouble installing mysql ruby gem on OS X Server 10.6.
This is the error I'm getting:
macserver:~ admin$ sudo env ARCHFLAGS="-arch x86_64" gem install mysql -- --with-mysql- config=/usr/bin/mysql_config
Building native extensions. This could take a while…
ERROR: Error installing mysql:
ERROR: Failed to build gem native extension.
/Users/admin/.rvm/rubies/ruby-1.8.7-p371/bin/ruby extconf.rb --with-mysql-config=/usr/bin/mysql_config
checking for mysql_ssl_set()… yes
checking for rb_str_set_len()… yes
checking for rb_thread_start_timer()… yes
checking for mysql.h… no
checking for mysql/mysql.h… no
*** 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/admin/.rvm/rubies/ruby-1.8.7-p371/bin/ruby
--with-mysql-config
Gem files will remain installed in /Users/admin/.rvm/gems/ruby-1.8.7-p371/gems/mysql-2.9.1 for inspection.
Results logged to /Users/admin/.rvm/gems/ruby-1.8.7-p371/gems/mysql-2.9.1/ext/mysql_api/gem_make.out
Any help is appreciated.
You need to have the development headers for MySQL installed. The default binary package from Oracle does not include these.
If you're using either Homebrew or MacPorts, both of these will be able to provide the required files.

Unable to install sqlite3-ruby gem

I've xcode 3.0 installed. And I need to install sqlite3-ruby gem (for rhosync).
When I run:
sudo gem install -l sqlite3-ruby
I get following error:
Building native extensions. This could take a while...
ERROR: Error installing sqlite3-ruby:
ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb
checking for #include <sqlite3.h>
... yes
checking for sqlite3_libversion_number() in -lsqlite3... yes
checking for rb_proc_arity()... no
checking for sqlite3_initialize()... no
sqlite3-ruby only supports sqlite3 versions 3.6.16+, please upgrade!
*** 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=/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
--with-sqlite3-dir
--without-sqlite3-dir
--with-sqlite3-include
--without-sqlite3-include=${sqlite3-dir}/include
--with-sqlite3-lib
--without-sqlite3-lib=${sqlite3-dir}/lib
--with-sqlite3lib
--without-sqlite3lib
Gem files will remain installed in /Library/Ruby/Gems/1.8/gems/sqlite3-ruby-1.3.1 for inspection.
Results logged to /Library/Ruby/Gems/1.8/gems/sqlite3-ruby-1.3.1/ext/sqlite3/gem_make.out
I've checked many links (on Stack Overflow and other sites) but nothing seems to work.
Some people suggest that install Ruby Headers from Mac OS X Disk 2. But I don't have that disc. I've instead installed XCode 3.0 SDK.
What should I do?
I installed MacPorts from http://macports.org and then ran
sudo port install sqlite3
after that sqlite3-ruby installed successfully.

Resources