Metasm is a pure ruby lib, and the core (metasm subdir) does not depend on any ruby library (except the metasm/gui, which can use gtk2/qt).

So the install is quite simple:

LOCAL INSTALLATION:

Either modify your RUBYLIB environment variable to include the directory containing metasm.rb e.g. under linux or cygwin: if you downloaded metasm to $HOME/metasm, you should have a file named $HOME/metasm/metasm.rb and need to add “export RUBYLIB=$RUBYLIB:~/metasm” to ~/.bash_profile

under windows: Add the path to the directory containing metasm.rb to the environment. This is accessible through: rightclick on 'my computer', tab 'advanced', environment. If a line RUBYLIB exists, add ':/path/to/metasmdir' at the end, otherwise create a new variable 'RUBYLIB' with value '/path/to/metasmdir'

SYSTEMWIDE INSTALLATION:

You can also copy the metasm.rb and the metasm subdirectory (the one containing ia32.rb and so on) under the ruby library path. e.g. cp -a metasm.rb metasm /usr/local/lib/site_ruby/1.8 (linux) select metasm.rb and metasm ; copy ; goto D:appsruby18libruby1.8\ ; paste (replace D:appsruby18 with the directory where you installed ruby) (win)

Note that metasm may not work well with rubygems, so disable it if you have the choice.

For a global installation, if you intend to use the DynLdr class (eg to call the native windows API), you should also run the metasm/dynldr.rb script on install/update, which will generate an up-to-date dynldr.so binary ruby module.

TESTING:

Once done, open a new session and type “ruby -r metasm -e 'p Metasm::VERSION'” at a commandline prompt, it should print a single line with a number in it.

GUI:

If you want to use the graphical interface (dbg/dasm), you need the ruby-gtk2 library. Under linux, use your package manager to install ruby-gtk2 e.g. for debian/ubuntu, type sudo apt-get install libgtk2-ruby

Under windows, you'll need to install the GTK2 and the ruby bindings manually. Please follow the instructions at: ruby-gnome2.sourceforge.jp/hiki.cgi?Install+Guide+for+Windows

To test, try to launch the script metasm/samples/disassemble-gui.rb (double click on it), it should show a program selection window. Type 'c' to start disassembling somewhere, and space to change to graph mode (see the script source for more key bindings)