{"id":32146806,"url":"https://github.com/getargv/getargv.swift","last_synced_at":"2026-02-18T22:01:27.452Z","repository":{"id":65265677,"uuid":"583844475","full_name":"getargv/getargv.swift","owner":"getargv","description":"Swift bindings to libgetargv","archived":false,"fork":false,"pushed_at":"2025-11-09T19:07:01.000Z","size":598,"stargazers_count":0,"open_issues_count":5,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-12-28T18:52:34.945Z","etag":null,"topics":["arguments","macos","processes","swift"],"latest_commit_sha":null,"homepage":"https://getargv.github.io/getargv.swift/documentation/swiftgetargv/","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/getargv.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}},"created_at":"2022-12-31T06:05:48.000Z","updated_at":"2025-11-09T19:05:54.000Z","dependencies_parsed_at":"2024-01-13T19:29:43.614Z","dependency_job_id":"ca90f346-2c63-420e-9698-bb4577818447","html_url":"https://github.com/getargv/getargv.swift","commit_stats":null,"previous_names":["getargv/getargv.swift"],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/getargv/getargv.swift","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/getargv%2Fgetargv.swift","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/getargv%2Fgetargv.swift/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/getargv%2Fgetargv.swift/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/getargv%2Fgetargv.swift/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/getargv","download_url":"https://codeload.github.com/getargv/getargv.swift/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/getargv%2Fgetargv.swift/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29596329,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-18T20:59:56.587Z","status":"ssl_error","status_checked_at":"2026-02-18T20:58:41.434Z","response_time":162,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["arguments","macos","processes","swift"],"created_at":"2025-10-21T08:28:50.423Z","updated_at":"2026-02-18T22:01:27.445Z","avatar_url":"https://github.com/getargv.png","language":"Swift","funding_links":["https://github.com/sponsors/CamJN"],"categories":[],"sub_categories":[],"readme":"\u003ch1\u003e\u003cimg src=\"logo.svg\" width=\"200\" alt=\"getargv\"\u003e\u003c/h1\u003e\n\n[![Swift CI](https://github.com/getargv/getargv.swift/actions/workflows/swift.yml/badge.svg)](https://github.com/getargv/getargv.swift/actions/workflows/swift.yml)\n\n`libgetargv` is a library that allows you to get the arguments that were passed to another running process on macOS. It is intended to provide roughly the same functionality as reading from `/proc/\u003cpid\u003e/cmdline` on Linux. On macOS this is done by parsing the output of the `KERN_PROCARGS2` sysctl, which is \u003cabbr title=\"always, in my observation\"\u003every often\u003c/abbr\u003e implemented [incorrectly](https://getargv.narzt.cam/hallofshame.html), due to the overlooked possibility of leading empty arguments passed to the target process. This package is the Swift bindings for the `libgetargv` library.\n\n## Permissions\n\n`libgetargv` can only see processes running as the same user by default, so be sure your process runs as the desired user (`setuid`, [`launchd.plist`](x-man-page://launchd.plist), [`sudo`](x-man-page://sudo)) or can [elevate privileges](https://developer.apple.com/library/archive/documentation/Security/Conceptual/SecureCodingGuide/Articles/AccessControl.html); n.b. elevating privileges safely is [extremely complicated](https://developer.apple.com/forums/thread/708765), and will be a target of privilege escalation attacks on macOS so be extremely careful if you go this route, better to defer to the user to elevate privileges for you as needed.\n\n## System Requirements\n\nmacOS is required as this is a macOS specific `sysctl`, even BSD does not implement it. Your system must support `sysctl` and `KERN_PROCARGS2`, which probably means macOS [10.3](https://github.com/apple-oss-distributions/xnu/blob/xnu-517/bsd/sys/sysctl.h#L332) or later, though I haven't tested versions older than 10.7. You'll also need a non-ancient clang (c99 is required) or you'll have to override the compiler flags with `CC`, `EXTRA_CPPFLAGS`, and `EXTRA_CFLAGS`.\n\n## Building `getargv.swift`\n\nTo make `getargv.swift`:\n\n - Install `libgetargv` to your system (see below).\n - Clone this repo and run `swift build` or\n - Add an entry to the dependencies array in your `Package` in your `Package.swift` file: `.package(url: \"https://github.com/getargv/getargv.swift\", from: \"0.0.9\")` and an entry in the dependencies array of your target `.product(name: \"Cgetargv\", package: \"getargv.swift\")`\n\n## Installing `libgetargv`\n\nTo get access to `libgetargv`, sign up for an appropriate [sponsorship tier](https://github.com/sponsors/CamJN).\n\nClone the `libgetargv` repo: `git clone https://github.com/getargv/getargv.git`.\n\nRunning `make install_dylib`, installs the library to the `/usr/local/` prefix by default; you can change the install location with the `PREFIX` `make` variable: `make PREFIX=/opt install_dylib`.\n\nI'm working on building binary artifacts to install without compilation, using `pkg` installers, however even once that's done, depending on your system, it may still be necessary to compile from source; eg. if you have built your own xnu kernel with a custom `PID_MAX` value.\n\n## Building `libgetargv`\nI've built `libgetargv` on macOS 10.7-15, using only the \u003cabbr title=\"Command Line Tools\"\u003eCLT\u003c/abbr\u003e package, not the full Xcode install. If you need to override variables, do so inside the `make` command, eg: `make EXTRA_CPPFLAGS=-DMACRO EXTRA_CFLAGS=-std=c17 dylib`. Since swift did not exist when 10.6 was current, that should not be a concern for this project.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgetargv%2Fgetargv.swift","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgetargv%2Fgetargv.swift","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgetargv%2Fgetargv.swift/lists"}