{"id":48883009,"url":"https://github.com/homebrew/patchelf.rb","last_synced_at":"2026-04-16T04:00:54.329Z","repository":{"id":52441525,"uuid":"163915146","full_name":"Homebrew/patchelf.rb","owner":"Homebrew","description":"ELF patcher implemented in pure Ruby!","archived":false,"fork":false,"pushed_at":"2026-04-15T00:15:08.000Z","size":9517,"stargazers_count":29,"open_issues_count":2,"forks_count":8,"subscribers_count":3,"default_branch":"master","last_synced_at":"2026-04-15T23:08:34.886Z","etag":null,"topics":["elf","patch","ruby"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Homebrew.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"github":"Homebrew","open_collective":"homebrew","patreon":"homebrew"}},"created_at":"2019-01-03T02:49:26.000Z","updated_at":"2026-04-15T00:15:10.000Z","dependencies_parsed_at":"2024-06-19T09:58:58.743Z","dependency_job_id":"afb7e75b-ae62-492f-a322-66a188f68ee8","html_url":"https://github.com/Homebrew/patchelf.rb","commit_stats":{"total_commits":66,"total_committers":10,"mean_commits":6.6,"dds":0.3484848484848485,"last_synced_commit":"94581a61c78654f35d9b4d435f48cbcb0765c480"},"previous_names":["homebrew/patchelf.rb","david942j/patchelf.rb"],"tags_count":10,"template":false,"template_full_name":null,"purl":"pkg:github/Homebrew/patchelf.rb","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Homebrew%2Fpatchelf.rb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Homebrew%2Fpatchelf.rb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Homebrew%2Fpatchelf.rb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Homebrew%2Fpatchelf.rb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Homebrew","download_url":"https://codeload.github.com/Homebrew/patchelf.rb/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Homebrew%2Fpatchelf.rb/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31870516,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-15T15:24:51.572Z","status":"online","status_checked_at":"2026-04-16T02:00:06.042Z","response_time":69,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["elf","patch","ruby"],"created_at":"2026-04-16T04:00:26.876Z","updated_at":"2026-04-16T04:00:54.313Z","avatar_url":"https://github.com/Homebrew.png","language":"Ruby","readme":"[![Downloads](https://img.shields.io/endpoint?url=https://gem-badge-h3lg.onrender.com/downloads/patchelf)](https://rubygems.org/gems/patchelf)\n\n[![Gem Version](https://badge.fury.io/rb/patchelf.svg)](https://badge.fury.io/rb/patchelf)\n[![Build Status](https://github.com/david942j/patchelf.rb/workflows/build/badge.svg)](https://github.com/david942j/patchelf.rb/actions)\n[![Maintainability](https://qlty.sh/gh/david942j/projects/patchelf.rb/maintainability.svg)](https://qlty.sh/gh/david942j/projects/patchelf.rb)\n[![Code Coverage](https://qlty.sh/gh/david942j/projects/patchelf.rb/coverage.svg)](https://qlty.sh/gh/david942j/projects/patchelf.rb)\n[![Yard Docs](http://img.shields.io/badge/yard-docs-blue.svg)](https://www.rubydoc.info/github/david942j/patchelf.rb/master)\n[![MIT License](https://img.shields.io/badge/license-MIT-blue.svg)](http://choosealicense.com/licenses/mit/)\n\n# patchelf.rb\n\nImplements features of NixOS/patchelf in pure Ruby.\n\n## Installation\n\nAvailable on RubyGems.org!\n```\n$ gem install patchelf\n```\n\n## Usage\n\n```\n$ patchelf.rb\n# Usage: patchelf.rb \u003ccommands\u003e FILENAME [OUTPUT_FILE]\n#         --print-interpreter, --pi    Show interpreter's name.\n#         --print-needed, --pn         Show needed libraries specified in DT_NEEDED.\n#         --print-runpath, --pr        Show the path specified in DT_RUNPATH.\n#         --print-soname, --ps         Show soname specified in DT_SONAME.\n#         --set-interpreter, --interp INTERP\n#                                      Set interpreter's name.\n#         --set-needed, --needed LIB1,LIB2,LIB3\n#                                      Set needed libraries, this will remove all existent needed libraries.\n#         --add-needed LIB             Append a new needed library.\n#         --remove-needed LIB          Remove a needed library.\n#         --replace-needed LIB1,LIB2   Replace needed library LIB1 as LIB2.\n#         --set-runpath, --runpath PATH\n#                                      Set the path of runpath.\n#         --force-rpath                According to the ld.so docs, DT_RPATH is obsolete,\n#                                      patchelf.rb will always try to get/set DT_RUNPATH first.\n#                                      Use this option to force every operations related to runpath (e.g. --runpath)\n#                                      to consider 'DT_RPATH' instead of 'DT_RUNPATH'.\n#         --set-soname, --so SONAME    Set name of a shared library.\n#         --version                    Show current gem's version.\n\n```\n\n### Display information\n```\n$ patchelf.rb --print-interpreter --print-needed /bin/ls\n# interpreter: /lib64/ld-linux-x86-64.so.2\n# needed: libselinux.so.1 libc.so.6\n\n```\n\n### Change the dynamic loader (interpreter)\n```\n# $ patchelf.rb --interp NEW_INTERP input.elf output.elf\n$ patchelf.rb --interp /lib/AAAA.so /bin/ls ls.patch\n\n$ file ls.patch\n# ls.patch: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib/AAAA.so, for GNU/Linux 3.2.0, BuildID[sha1]=9567f9a28e66f4d7ec4baf31cfbf68d0410f0ae6, stripped\n\n```\n\n### Modify dependency libraries\n\n#### Add\n```\n$ patchelf.rb --add-needed libnew.so /bin/ls ls.patch\n```\n\n#### Remove\n```\n$ patchelf.rb --remove-needed libc.so.6 /bin/ls ls.patch\n```\n\n#### Replace\n```\n$ patchelf.rb --replace-needed libc.so.6,libcnew.so.6 /bin/ls ls.patch\n\n$ readelf -d ls.patch | grep NEEDED\n#  0x0000000000000001 (NEEDED)             Shared library: [libselinux.so.1]\n#  0x0000000000000001 (NEEDED)             Shared library: [libcnew.so.6]\n\n```\n\n#### Set directly\n```\n$ patchelf.rb --needed a.so,b.so,c.so /bin/ls ls.patch\n\n$ readelf -d ls.patch | grep NEEDED\n#  0x0000000000000001 (NEEDED)             Shared library: [a.so]\n#  0x0000000000000001 (NEEDED)             Shared library: [b.so]\n#  0x0000000000000001 (NEEDED)             Shared library: [c.so]\n\n```\n\n### Set RUNPATH of an executable\n```\n$ patchelf.rb --runpath . /bin/ls ls.patch\n\n$ readelf -d ls.patch | grep RUNPATH\n#  0x000000000000001d (RUNPATH)            Library runpath: [.]\n\n```\n\n### Change SONAME of a shared library\n```\n$ patchelf.rb --so libc.so.217 /lib/x86_64-linux-gnu/libc.so.6 libc.patch\n\n$ readelf -d libc.patch | grep SONAME\n#  0x000000000000000e (SONAME)             Library soname: [libc.so.217]\n\n```\n\n### As Ruby library\n```rb\nrequire 'patchelf'\n\npatcher = PatchELF::Patcher.new('/bin/ls')\npatcher.interpreter\n#=\u003e \"/lib64/ld-linux-x86-64.so.2\"\n\npatcher.interpreter = '/lib/AAAA.so.2'\npatcher.interpreter\n#=\u003e \"/lib/AAAA.so.2\"\n\npatcher.save('ls.patch')\n\n# $ file ls.patch\n# ls.patch: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib/AAAA.so.2, for GNU/Linux 3.2.0, BuildID[sha1]=9567f9a28e66f4d7ec4baf31cfbf68d0410f0ae6, stripped\n\n```\n\n## Environment\n\npatchelf.rb is implemented in pure Ruby, so it should work in all environments include Linux, macOS, and Windows!\n\n## Project Authors\n\nThe git history remains the definitive record of all contributions.\n\n### Original Author and Project Founder\n\n* david942j (@david942j)\n\n### Maintainers\n\n* david942j (@david942j)\n","funding_links":["https://github.com/sponsors/Homebrew","https://opencollective.com/homebrew","https://patreon.com/homebrew"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhomebrew%2Fpatchelf.rb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhomebrew%2Fpatchelf.rb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhomebrew%2Fpatchelf.rb/lists"}