17 September 2012

Hosts file gets reset after reboot on Mac Lion

I updated my hosts file on my Mac by doing the following:

sudo vi /etc/hosts

but it was reset every time when system was rebooted.

The reason being I have installed Cisco AnyConnect VPN client, which keeps a separate copy of the original hosts file, and will restore my hosts file from it each time after reboot.

ls /etc/hosts*   =>  /etc/hosts   /etc/hosts.ac    /etc/hosts.equiv

So the solution is to update both "/etc/hosts" and "/etc/hosts.ac" to keep them in sync.

Hope this helps you too.


12 September 2012

Missing "usb.h" for Blinky on you Mac?

Playing with Blinky today, but getting the following lovely error messages:

Installing ruby-usb (0.2.1) with native extensions 
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

/Users/felix/.rvm/rubies/ruby-1.9.2-p290/bin/ruby extconf.rb 
checking for usb_init() in -lusb... no
checking for ruby/st.h... yes
creating Makefile

Makefile:165: warning: overriding commands for target `/Users/felix/.rvm/gems/ruby-1.9.2-p290@blinky/gems/ruby-usb-0.2.1/lib'
Makefile:163: warning: ignoring old commands for target `/Users/felix/.rvm/gems/ruby-1.9.2-p290@blinky/gems/ruby-usb-0.2.1/lib'
clang -I. -I/Users/felix/.rvm/rubies/ruby-1.9.2-p290/include/ruby-1.9.1/x86_64-darwin11.4.0 -I/Users/felix/.rvm/rubies/ruby-1.9.2-p290/include/ruby-1.9.1/ruby/backward -I/Users/felix/.rvm/rubies/ruby-1.9.2-p290/include/ruby-1.9.1 -I. -DHAVE_RUBY_ST_H -I/Users/felix/.rvm/usr/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE   -fno-common -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-missing-field-initializers -Wshorten-64-to-32 -Wno-long-long  -fno-common -pipe  -o usb.o -c usb.c
clang: warning: argument unused during compilation: '-ggdb'
usb.c:27:10: fatal error: 'usb.h' file not found
#include <usb.h>
1 error generated.
make: *** [usb.o] Error 1

Gem files will remain installed in /Users/felix/.rvm/gems/ruby-1.9.2-p290@blinky/gems/ruby-usb-0.2.1 for inspection.
Results logged to /Users/felix/.rvm/gems/ruby-1.9.2-p290@blinky/gems/ruby-usb-0.2.1/./gem_make.out
An error occured while installing ruby-usb (0.2.1), and Bundler cannot continue.
Make sure that `gem install ruby-usb -v '0.2.1'` succeeds before bundling.

Why? -- Because I didn't follow the instructions!

Well, after coming back and reading through all the instructions on Blinky Wiki page, I thought it would be very easy, but it turned out not.