https://github.com/Homebrew/ruby-macho
🔩 A pure-Ruby library for parsing Mach-O files.
https://github.com/Homebrew/ruby-macho
Keywords
apple homebrew mach macos ruby ruby-gem ruby-library
Keywords from Contributors
rubygems feature-flag sorbet feature-toggle feature oauth2-server oauth2-provider oauth2 oauth identity
Last synced: about 18 hours ago
JSON representation
Repository metadata
🔩 A pure-Ruby library for parsing Mach-O files.
- Host: GitHub
- URL: https://github.com/Homebrew/ruby-macho
- Owner: Homebrew
- License: mit
- Created: 2015-07-15T21:40:05.000Z (about 11 years ago)
- Default Branch: main
- Last Pushed: 2026-09-25T13:06:33.000Z (10 days ago)
- Last Synced: 2026-09-29T00:49:36.710Z (7 days ago)
- Topics: apple, homebrew, mach, macos, ruby, ruby-gem, ruby-library
- Language: Ruby
- Homepage: https://rubygems.org/gems/ruby-macho
- Size: 2.37 MB
- Stars: 261
- Watchers: 13
- Forks: 36
- Open Issues: 0
- Releases: 17
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
README.md
ruby-macho
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"
Ad-hoc code signing
Changing a Mach-O load command invalidates any existing code signature. This is
especially important when Homebrew pours bottles on Apple Silicon, where native
code must remain signed after its paths are rewritten. MachO.codesign! creates
the required ad-hoc signature in Ruby instead of invoking /usr/bin/codesign:
MachO.codesign!("/path/to/my/binary")
What works?
- Reading data from x86/x86_64/arm64/PPC Mach-O files (other architectures are unsupported, but may work)
- Changing the IDs of Mach-O and Fat dylibs
- Changing install names in Mach-O and Fat files
- Adding, deleting, and modifying rpaths.
- Parsing embedded code signatures and applying ad-hoc signatures in pure Ruby.
Contributing
See CONTRIBUTING.md for repository setup, checks, fixture
guidance, and the contribution process.
Attribution
- Constants were taken from Apple, Inc's
loader.hincctools/include/mach-o.
(Apple Public Source License 2.0). - Code-signing constants and structures follow Apple, Inc's
cs_blobs.hin XNU. - Binary files used for testing were taken from The LLVM Project. (Apache License v2.0 with LLVM Exceptions).
License
ruby-macho is licensed under the MIT License.
For the exact terms, see the license file.
Owner metadata
- Name: Homebrew
- Login: Homebrew
- Email:
- Kind: organization
- Description: The missing package manager for macOS (or Linux)
- Website: https://brew.sh
- Location: GitHub
- Twitter: MacHomebrew
- Company:
- Icon url: https://avatars.githubusercontent.com/u/1503512?v=4
- Repositories: 28
- Last ynced at: 2024-10-29T17:10:41.779Z
- Profile URL: https://github.com/Homebrew
GitHub Events
Total
- Create event: 214
- Delete event: 205
- Fork event: 5
- Issue comment event: 20
- Member event: 1
- Pull request event: 415
- Pull request review comment event: 9
- Pull request review event: 119
- Push event: 241
- Watch event: 10
Last Year
- Create event: 44
- Delete event: 38
- Fork event: 1
- Issue comment event: 6
- Member event: 1
- Pull request event: 88
- Pull request review comment event: 9
- Pull request review event: 22
- Push event: 53
- Watch event: 1
Committers metadata
Last synced: 2 days ago
Total Commits: 1,252
Total Committers: 22
Avg Commits per committer: 56.909
Development Distribution Score (DDS): 0.598
Commits in past year: 157
Committers in past year: 8
Avg Commits per committer in past year: 19.625
Development Distribution Score (DDS) in past year: 0.465
| Name | Commits | |
|---|---|---|
| dependabot[bot] | 4****] | 503 |
| William Woodruff | w****m@t****m | 343 |
| dependabot-preview[bot] | 2****] | 159 |
| BrewTestBot | 1****t | 101 |
| dependabot[bot] | s****t@d****m | 43 |
| Martin Afanasjew | m****n@a****e | 22 |
| Mike McQuaid | m****e@m****m | 17 |
| Patrick Linnane | p****k@l****o | 14 |
| Bo Anderson | m****l@b****e | 11 |
| Caleb Xu | c****r@l****m | 8 |
| Carlo Cabrera | 3****b | 7 |
| BrewTestBot | h****t@l****g | 5 |
| Rick Mark | r****k@o****m | 5 |
| Kevin | a****k@g****m | 4 |
| Misty De Meo | m****o@g****m | 3 |
| Andrew Nesbitt | a****z@g****m | 1 |
| Branch Vincent | b****t@g****m | 1 |
| Jonathan Chang | j****1@g****m | 1 |
| Rylan Polster | r****r@g****m | 1 |
| Thierry Moisan | t****n@g****m | 1 |
| Juhani Krekelä | j****i@k****i | 1 |
| leonklingele | g****t@l****e | 1 |
Committer domains:
- leonklingele.de: 1
- krekelä.fi: 1
- lists.sfconservancy.org: 1
- boanderson.me: 1
- linnane.io: 1
- mikemcquaid.com: 1
- afanasjew.de: 1
- dependabot.com: 1
- tuffbizz.com: 1
Issue and Pull Request metadata
Last synced: 2 days ago
Total issues: 49
Total pull requests: 1,262
Average time to close issues: over 1 year
Average time to close pull requests: 3 days
Total issue authors: 15
Total pull request authors: 21
Average comments per issue: 3.24
Average comments per pull request: 0.45
Merged pull request: 1,146
Bot issues: 7
Bot pull requests: 956
Past year issues: 1
Past year pull requests: 130
Past year average time to close issues: about 3 hours
Past year average time to close pull requests: about 6 hours
Past year issue authors: 1
Past year pull request authors: 8
Past year average comments per issue: 1.0
Past year average comments per pull request: 0.19
Past year merged pull request: 130
Past year bot issues: 0
Past year bot pull requests: 83
Top Issue Authors
- woodruffw (24)
- UniqMartin (4)
- dependabot-preview[bot] (4)
- carlocab (3)
- dependabot[bot] (3)
- rickmark (2)
- nortti0 (1)
- sashkab (1)
- abarisain (1)
- ablazhey (1)
- xu-cheng (1)
- iOS-Developer-Sun (1)
- yurikoles (1)
- shekhar-suman (1)
- tgnottingham (1)
Top Pull Request Authors
- dependabot[bot] (728)
- dependabot-preview[bot] (228)
- BrewTestBot (135)
- woodruffw (86)
- Bo98 (16)
- p-linnane (15)
- UniqMartin (12)
- MikeMcQuaid (9)
- carlocab (8)
- rickmark (5)
- Moisan (4)
- apainintheneck (4)
- mistydemeo (3)
- andrew (2)
- Rylan12 (1)
Top Issue Labels
- outdated (37)
- enhancement (19)
- help wanted (13)
- bug (8)
- test-suite (8)
- long-term (3)
- dependencies (3)
- in progress (3)
- question (2)
- ruby (2)
- Stale (2)
- github_actions (2)
- optimization (1)
- libmacho-divergence (1)
Top Pull Request Labels
- dependencies (956)
- ruby (601)
- outdated (581)
- github_actions (241)
- enhancement (38)
- test-suite (17)
- bug (12)
- in progress (9)
- libmacho-divergence (2)
- 1.8.7 (2)
- optimization (2)
- documentation (2)
- old-archs (1)
- do not merge (1)
- performance (1)
- Stale (1)
- needs response (1)
Package metadata
- Total packages: 5
-
Total downloads:
- rubygems: 219,104,068 total
- Total docker downloads: 88,494,410
- Total dependent packages: 10 (may contain duplicates)
- Total dependent repositories: 26,346 (may contain duplicates)
- Total versions: 105
- Total maintainers: 3
gem.coop: ruby-macho
A library for viewing and manipulating Mach-O files in Ruby.
- Homepage: https://github.com/Homebrew/ruby-macho
- Documentation: http://www.rubydoc.info/gems/ruby-macho/
- Licenses: MIT
- Latest release: 7.0.0 (published 30 days ago)
- Last Synced: 2026-10-04T00:01:51.110Z (2 days ago)
- Versions: 42
- Dependent Packages: 0
- Dependent Repositories: 0
- Downloads: 109,552,034 Total
- Docker Downloads: 44,247,205
-
Rankings:
- Dependent repos count: 0.0%
- Dependent packages count: 0.0%
- Average: 0.228%
- Downloads: 0.281%
- Docker downloads count: 0.631%
- Maintainers (3)
-
Funding:
- https://github.com/sponsors/Homebrew
rubygems.org: ruby-macho
A library for viewing and manipulating Mach-O files in Ruby.
- Homepage: https://github.com/Homebrew/ruby-macho
- Documentation: http://www.rubydoc.info/gems/ruby-macho/
- Licenses: MIT
- Latest release: 7.0.0 (published 30 days ago)
- Last Synced: 2026-10-04T00:01:52.234Z (2 days ago)
- Versions: 42
- Dependent Packages: 10
- Dependent Repositories: 26,346
- Downloads: 109,552,034 Total
- Docker Downloads: 44,247,205
-
Rankings:
- Dependent repos count: 0.219%
- Downloads: 0.336%
- Docker downloads count: 0.871%
- Dependent packages count: 1.745%
- Average: 1.855%
- Stargazers count: 3.772%
- Forks count: 4.188%
- Maintainers (3)
-
Funding:
- https://github.com/sponsors/Homebrew
proxy.golang.org: github.com/homebrew/ruby-macho
- Homepage:
- Documentation: https://pkg.go.dev/github.com/homebrew/ruby-macho#section-documentation
- Licenses: mit
- Latest release: v7.0.0+incompatible (published 30 days ago)
- Last Synced: 2026-10-04T00:01:53.748Z (2 days ago)
- Versions: 10
- Dependent Packages: 0
- Dependent Repositories: 0
-
Rankings:
- Stargazers count: 3.434%
- Forks count: 3.769%
- Average: 6.895%
- Dependent packages count: 9.576%
- Dependent repos count: 10.802%
proxy.golang.org: github.com/Homebrew/ruby-macho
- Homepage:
- Documentation: https://pkg.go.dev/github.com/Homebrew/ruby-macho#section-documentation
- Licenses: mit
- Latest release: v7.0.0+incompatible (published 28 days ago)
- Last Synced: 2026-10-04T00:01:53.837Z (2 days ago)
- Versions: 10
- Dependent Packages: 0
- Dependent Repositories: 0
-
Rankings:
- Stargazers count: 3.434%
- Forks count: 3.769%
- Average: 6.895%
- Dependent packages count: 9.576%
- Dependent repos count: 10.802%
gentoo-portage: dev-ruby/ruby-macho
A library for viewing and manipulating Mach-O files in Ruby
- Homepage: https://github.com/Homebrew/ruby-macho
- Documentation: https://packages.gentoo.org/packages/dev-ruby/ruby-macho
- Licenses: MIT
- Latest release: 4.1.0 (published 6 months ago)
- Last Synced: 2026-09-14T07:26:16.326Z (21 days ago)
- Versions: 1
- Dependent Packages: 0
- Dependent Repositories: 0
-
Rankings:
- Dependent repos count: 0.0%
- Dependent packages count: 0.0%
- Average: 100%
Dependencies
- benchmark-ips >= 0 development
- codecov >= 0 development
- minitest >= 0 development
- overcommit >= 0 development
- rake >= 0 development
- rubocop >= 0 development
- ast 2.4.2
- benchmark-ips 2.10.0
- childprocess 4.1.0
- codecov 0.6.0
- docile 1.4.0
- iniparse 1.5.0
- json 2.6.2
- minitest 5.16.2
- overcommit 0.59.1
- parallel 1.22.1
- parser 3.1.2.0
- rainbow 3.1.1
- rake 13.0.6
- regexp_parser 2.5.0
- rexml 3.2.5
- rubocop 1.31.2
- rubocop-ast 1.19.1
- ruby-progressbar 1.11.0
- simplecov 0.21.2
- simplecov-html 0.12.3
- simplecov_json_formatter 0.1.4
- unicode-display_width 2.2.0
- actions/checkout main composite
- ruby/setup-ruby v1 composite
- actions/checkout 08c6903cd8c0fde910a37f88322edcfb5dd907a8 composite
- ruby/setup-ruby d5126b9b3579e429dd52e51e68624dda2e05be25 composite
- rubygems/release-gem 1c162a739e8b4cb21a676e97b087e8268d8fc40b composite
- Homebrew/actions/setup-homebrew main composite
- actions/checkout 1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 composite
- actions/download-artifact 018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 composite
- actions/upload-artifact 330a01c490aca151604b8cf639adc76d48f6c5d4 composite
- github/codeql-action/upload-sarif fdbfb4d2750291e159f0156def62b853c2798ca2 composite
- ruby *
- actions/stale 4391f3da665fdf50b6810c1a66712fb9ba21aa93 composite
- Homebrew/actions/setup-homebrew 8f3d1ec8a696b3b9d9a6c3696b6c73033cab69e4 composite
- actions/cache 55cc8345863c7cc4c66a329aec7e433d2d1c52a9 composite
- actions/checkout 3d3c42e5aac5ba805825da76410c181273ba90b1 composite
Score: 28.199957433651615