Ramblings Of a Madman

Yeah, like i would know a good description…

Posts for Tag: error

'Error compiling pg Ruby gem on OSX'

If you get this error (or similar) while trying to run **bundle install** on one of your Ruby projects or trying to install the **pg** gem:

Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

/Users/void/.rvm/rubies/ruby-2.0.0-p0/bin/ruby extconf.rb --with-iconv-include=/usr/local/opt/libiconv/include --with-iconv-lib=/usr/local/opt/libiconv/lib 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.

The solution is to install the gem like this:

sudo env ARCHFLAGS="-arch i386" gem install pg -- --with-pg-include=/Library/PostgreSQL/8.4/include/ --with-pg-lib=/Library/PostgreSQL/8.4/lib/

**Note:** Replace 8.4 with your installed PostgreSQL version in the above command.

'OSX Mavericks "You need a Java 6 runtime to run X" error dialog fix'

Ok, so here's the deal: If you upgrade to [OSX Mavericks](https://www.apple.com/osx/preview/), only had JAVA 7 installed, and try to run anything that requires JAVA you will probably get a nice dialog like this one:

All my attempts to make Mavericks use JAVA 7 instead have failed so i tried the next best thing: Install JAVA 6. Since you can't find JAVA 6 for Mac at the [Oracle](http://java.oracle.com) site, you'll have to install it from here: [Java for OS X 2013-004](http://support.apple.com/kb/DL1572).

After installing you'll end up with this following structure at the "/System/Library/Frameworks/JavaVM.framework/Versions" folder:

drwxr-xr-x 11 root wheel 374 29 Ago 14: lrwxr-xr-x 1 root wheel 10 29 Ago 14:58 1.4@ -> CurrentJDK lrwxr-xr-x 1 root wheel 10 29 Ago 14:58 1.4.2@ -> CurrentJDK lrwxr-xr-x 1 root wheel 10 29 Ago 14:58 1.5@ -> CurrentJDK lrwxr-xr-x 1 root wheel 10 29 Ago 14:58 1.5.0@ -> CurrentJDK lrwxr-xr-x 1 root wheel 10 29 Ago 14:58 1.6@ -> CurrentJDK lrwxr-xr-x 1 root wheel 10 29 Ago 14:58 1.6.0@ -> CurrentJDK drwxr-xr-x 7 root wheel 238 29 Ago 14:58 A/ lrwxr-xr-x 1 root wheel 1 29 Ago 14:58 Current@ -> A lrwxr-xr-x 1 root wheel 59 29 Ago 14:58 CurrentJDK@ -> /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents

So you might want to fix the path to the current JDK, so that you keep using the JDK 7 by default (Eclipse users, you know what i mean ;)):

$ sudo rm CurrentJDK $ sudo ln -s /Library/Java/ $ sudo ln -s /Library/Java/JavaVirtualMachines/jdk1.7.0_25.jdk/Contents CurrentJDK

Another thing you might need to change is the JAVA_HOME environment variable but, since that depends on whatever shell you use, [Google it](https://duckduckgo.com/?q=set+JAVA_HOME+in+bash) ;)

Finally, verify that you are still using JAVA 7 by default:

$ javac -version javac 1.7.0_25 $ java -version java version "1.7.0_25"

Have fun.