Skip to content

🔩 A pure-Ruby library for parsing Mach-O files.

License

Notifications You must be signed in to change notification settings

Xtuden-com/ruby-macho

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ruby-macho

Gem Version Build Status Coverage Status

A Ruby library for examining and modifying Mach-O files.

What is a Mach-O file?

The Mach-O file format is used by macOS and iOS (among others) as a general purpose binary format for object files, executables, dynamic libraries, and so forth.

Installation

ruby-macho can be installed via RubyGems:

$ gem install ruby-macho

Documentation

Full documentation is available on RubyDoc.

A quick example of what ruby-macho can do:

require 'macho'

file = MachO::MachOFile.new("/path/to/my/binary")

# get the file's type (object, dynamic lib, executable, etc)
file.filetype # => :execute

# get all load commands in the file and print their offsets:
file.load_commands.each do |lc|
  puts "#{lc.type}: offset #{lc.offset}, size: #{lc.cmdsize}"
end

# access a specific load command
lc_vers = file[:LC_VERSION_MIN_MACOSX].first
puts lc_vers.version_string # => "10.10.0"

What works?

  • Reading data from x86/x86_64/PPC Mach-O files
  • Changing the IDs of Mach-O and Fat dylibs
  • Changing install names in Mach-O and Fat files
  • Adding, deleting, and modifying rpaths.

What needs to be done?

  • Unit and performance testing.

Attribution:

License

ruby-macho is licensed under the MIT License.

For the exact terms, see the license file.

About

🔩 A pure-Ruby library for parsing Mach-O files.

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Ruby 97.0%
  • Makefile 1.9%
  • Other 1.1%