Created
March 5, 2014 18:56
-
-
Save kernelsmith/9374042 to your computer and use it in GitHub Desktop.
Install Ruby Inject on OS X 10.5+
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| == RubyInject == | |
| RubyInject is a Mac OS X framework that allows you to inject at runtime the | |
| Ruby interpreter into any running application, using the mach_star mechanism. | |
| It will spawn a new thread on the remote process, initialize the Ruby | |
| interpreter, start a new DRb server that exposes an expression evaluator, and | |
| advertises the DRb server URI on bonjour (if you have the ruby-dnssd library). | |
| https://github.com/rentzsch/mach_star | |
| == Requirements == | |
| - Mac OS X 10.5. | |
| - RubyCocoa 0.13.0 or later. | |
| == Installation == | |
| $ mkdir ~/ruby_inject && cd ~/ruby_inject | |
| # Download http://downloads.sourceforge.net/project/rubycocoa/RubyCocoa/1.1.0/RubyCocoa-1.1.0-OSX10.8.dmg | |
| $ open RubyCocoa-1.1.0-OSX10.8.dmg | |
| # Double click the .pkg, follow prompts etc | |
| $ rm -rf RubyCocoa-1.1.0-OSX10.8.dmg | |
| ##### do we skip this | |
| = Mach Inject = | |
| $ git clone https://github.com/rentzsch/mach_inject.git | |
| $ cd mach_inject/mach_inject_bundle | |
| $ xcodebuild | |
| $ sudo cp -r build/Default/mach_inject_bundle.framework/ /Library/Frameworks/ | |
| ##### | |
| = Ruby Inject = | |
| RubyInject comes in 2 parts. First, the framework, that you build & install: | |
| $ cd ~/ruby_inject | |
| # Download RubyInject-0.1.0.tar.gz from http://sourceforge.net/projects/rubycocoa/files/RubyInject/0.1.0/ | |
| $ tar -xzvf RubyInject-0.1.0.tar.gz || tar -xvf RubyInject-0.1.0.tar # depending | |
| $ cd RubyInject-0.1.0 | |
| $ xcodebuild SYMROOT=/tmp | |
| $ cp -r /tmp/Release/RubyInject.framework /Library/Frameworks | |
| The second part is the client, which uses the framework to inject Ruby, then | |
| waits on bonjour to connect to the DRb server. It is a Ruby script named | |
| inject.rb. | |
| You can manually copy inject.rb in one of the directories of your $PATH, | |
| or simply call it from the RubyInject project directory. | |
| == Usage == | |
| $ sudo ruby inject.rb <pid> <ruby-script> | |
| <pid> is the process ID of the application you want to inject Ruby to. | |
| <ruby-script> is the path of a Ruby script that will be directly evaluated | |
| after the injection. This is optional, if this parameter is not used an IRB | |
| session will be started instead. | |
| == Samples == | |
| See the samples directory. | |
| == About == | |
| The author is Laurent Sansonetti <lrz@chopine.be>. | |
| See the COPYRIGHT file for details about licensing. | |
| RubyInject has a home page, http://rubycocoa.sf.net/RubyInject | |
| The latest bits are available on SVN: | |
| $ svn co https://rubycocoa.svn.sourceforge.net/svnroot/rubycocoa/branches/users/lrz/RubyInject |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment