RubyCocoaを使う
http://qiita.com/tgck@github/items/ebfa6332532c26cb7906
デフォルトのRuby(1.8)を使わないとrequire 'osx/cocoa'できないみたい
mouse.rb
require 'osx/cocoa' while true event=OSX::CGEventCreate(nil); pt = OSX::CGEventGetLocation(event); print pt.x, ':', pt.y; print "\n" sleep 0.1 end
$ /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby mouse.rb