{"id":16682172,"url":"https://github.com/johnfairh/cruby","last_synced_at":"2025-10-07T06:01:50.182Z","repository":{"id":49091731,"uuid":"124664533","full_name":"johnfairh/CRuby","owner":"johnfairh","description":"Swift system module for libruby","archived":false,"fork":false,"pushed_at":"2024-04-23T09:55:24.000Z","size":31,"stargazers_count":9,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-17T22:08:42.602Z","etag":null,"topics":["linux","macos","ruby","swift","swiftpm"],"latest_commit_sha":null,"homepage":"","language":"Perl","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/johnfairh.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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}},"created_at":"2018-03-10T14:41:27.000Z","updated_at":"2024-08-02T13:15:01.000Z","dependencies_parsed_at":"2025-04-09T23:12:59.611Z","dependency_job_id":null,"html_url":"https://github.com/johnfairh/CRuby","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/johnfairh/CRuby","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johnfairh%2FCRuby","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johnfairh%2FCRuby/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johnfairh%2FCRuby/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johnfairh%2FCRuby/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/johnfairh","download_url":"https://codeload.github.com/johnfairh/CRuby/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johnfairh%2FCRuby/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270469999,"owners_count":24589270,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-14T02:00:10.309Z","response_time":75,"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":["linux","macos","ruby","swift","swiftpm"],"created_at":"2024-10-12T14:06:27.110Z","updated_at":"2025-10-07T06:01:50.079Z","avatar_url":"https://github.com/johnfairh.png","language":"Perl","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003c!--\nCRuby\nREADME.md\nDistributed under the MIT license, see LICENSE.\n--\u003e\n\n![Platforms](https://img.shields.io/badge/platform-macOS%20%7C%20linux-lightgrey.svg)\n![License](https://cocoapod-badges.herokuapp.com/l/RubyGateway/badge.png)\n\n# CRuby\n\nWrap `libruby` for SwiftPM or Xcode.  Easily reconfigure for your Ruby\ninstallation.\n\nSee [RubyGateway](https://github.com/johnfairh/RubyGateway) for a high-level\nSwift-Ruby integration framework.\n\nTested with environments:\n* macOS 14 system Ruby (still 2.6 - beware)\n* macOS Homebrew, RBEnv, RVM\n* macOS bespoke installation\n* Ubuntu Jammy bespoke, RBEnv, RVM\n\nAnd Ruby versions:\n* 2.6 - 3.3\n\n## Usage\n\n`CRuby` comes set up to use the macOS system Ruby, and Xcode to provide C\nheaders.\n\nIf you want to use a different Ruby then use the `cfg-cruby` script to\nrewrite the build config files.\n\nFor options other than macOS system Ruby, `cfg-cruby` generates a custom\npkg-config file called `CRuby.pc` for `swift build`, and an Xcconfig file\ncalled `CRuby.xcconfig` for Xcode.\n\n### Swift Package Manager\n\nInclude this repo as a dependency in your project:\n```swift\n.package(url: \"https://github.com/johnfairh/CRuby/\", majorVersion: 2)\n```\n\nTo use a Ruby other than macOS system default you need to reconfigure.  For\nexample to set up Ruby 3.3.0 managed by `rbenv`:\n```shell\nswift package edit CRuby\n./Packages/CRuby/cfg-cruby --mode rbenv --name 3.3.0\nexport PKG_CONFIG_PATH=$(pwd)/Packages/CRuby:$PKG_CONFIG_PATH\nswift build\n```\nEither leave the `CRuby` package in edit mode or fork the repo, use that fork\nas your remote, and push your customizations back there.\n\n### Xcode\n\nInclude this repo in your project.  A git submodule works well.  So either way\nyou have a directory called `CRuby`.  Then go to *Build Settings* for the Target\nwhere you want to do `import CRuby` and find *Import Paths* under *Swift\nCompiler - Search Paths*.  Add the path to your `CRuby` directory - you can\nuse `${SRCROOT}` to substitute for the directory containing the project file.\n\nCheck Xcode is happy with an `import CRuby` line.  This is using the macOS\nsystem default Ruby, probably a very old 2.6.\n\nIf you want to use a different Ruby, run `cfg-cruby`.  This creates a file\ncalled `CRuby.xcconfig` that you need to include in the appropriate targets.\nStart [here](https://nshipster.com/xcconfig/) for help with using xcconfig\nfiles.\n\nThat's it: Xcode should now resolve `CRuby` against your chosen version.\n\n## Supported Ruby Configs\n\n### macOS system\n\nUse the `xcode-select`ed Xcode:\n```shell\ncfg-cruby --mode xcode\n```\nThis configuration does not require a pkg-config file.\n\n### macOS Homebrew or Linux -dev package\n\n```shell\ncfg-cruby --mode pkgconfig --name \u003cpkg-name\u003e\n```\nUse `pkg-config --list-all` to see what you have installed.\n\nThe pkg-config setup is not directly consumable by SwiftPM.  `cfg-cruby` uses\nit to create the `CRuby.pc` that is compatible with SwiftPM.\n\n### RBEnv or RVM\n\n```shell\ncfg-cruby --mode rbenv --name \u003cversion\u003e\n```\n\nor\n\n```shell\ncfg-cruby --mode rvm --name \u003cruby name\u003e\n```\n\n### Something else\n\nIf you've built Ruby yourself or are using a different version manager that\npreserves the regular layout then:\n\n```shell\ncfg-cruby --path \u003cfull path to Ruby directory\u003e\n```\n\nThe path required is one to a directory that is called `ruby-*something*` and\ncontains subdirectories including `lib`, `include`, and `bin`.\n\n## Contributions\n\nWelcome - github / johnfairh@gmail.com\n\n## License\n\nDistributed under the MIT license.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjohnfairh%2Fcruby","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjohnfairh%2Fcruby","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjohnfairh%2Fcruby/lists"}