Author Archives: john

Install ruby ‘pg’ library problems

After I’ve installed postgresql, the problem with ‘pg’ library persisted

sudo gem install pg -v '0.11.0'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby extconf.rb
checking for pg_config... yes
Using config values from /usr/local/bin/pg_config
checking for libpq-fe.h... yes
checking for libpq/libpq-fs.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

The solution for this is to run the installer in this way:

sudo env ARCHFLAGS="-arch x86_64" gem install pg

How to fix grunt error “Cannot find module ‘lru-cache'”

To fix this error is very simple: you just have tot clean your node modules:

$ grunt install:development
Loading "Gruntfile.js" tasks...ERROR
>> Error: Cannot find module 'lru-cache'
Warning: Task "install:development" not found. Use --force to continue.

Aborted due to warnings.

john@C370012100004 /C/projects/nodejsp(develop)
$ rm -rf node_modules && npm cache clean && npm install

Creating a tunnel using ssh

If you want to forward a port to your computer from another, and you can create a ssh connection to the computer, then creating the actual tunnel is very simple.

This exemple forwards the port 7000 from that computer to a port on our computer. In this case the local port in 5000

ssh -N -p 22 -L 5000/localhost/7000

How to edit the hosts file on Mac OS X

The hosts file in a computer represents a simple plain text file, where are mapped hostnames to IP addresses (wiki).

To edit this file on Mac OS X is a very simple task:

  • Open the 
    (using Spotlight : command + space  – and then write terminal)
  • Edit the file /private/etc/hosts
    (you can use vim or nano …. ex: sudo nano /private/etc/hosts)
  •  Add the new map:
    add at the end the new map you want : ex:
  • Save the hosts file
    save the file with the new map

If you want that your change to take place immediately, run the following command:

  • dscacheutil -flushcache

Now you can test the new mapping.