{"id":22862419,"url":"https://github.com/dylibso/hermit","last_synced_at":"2025-09-22T09:20:10.947Z","repository":{"id":203676921,"uuid":"690160672","full_name":"dylibso/hermit","owner":"dylibso","description":"Actually Portable WebAssembly compiler toolchain for self-contained cross-platform binaries","archived":false,"fork":false,"pushed_at":"2024-09-03T22:14:11.000Z","size":1270,"stargazers_count":211,"open_issues_count":8,"forks_count":12,"subscribers_count":8,"default_branch":"main","last_synced_at":"2025-05-20T09:03:57.460Z","etag":null,"topics":["compiler","container","cosmopolitan-libc","cross-platform","wasm"],"latest_commit_sha":null,"homepage":"https://dylibso.com/blog/hermit-actually-portable-wasm/","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dylibso.png","metadata":{"files":{"readme":".github/readme-header.jpg","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}},"created_at":"2023-09-11T16:41:46.000Z","updated_at":"2025-05-17T16:32:59.000Z","dependencies_parsed_at":"2025-01-31T17:35:02.740Z","dependency_job_id":"6af6d708-7ea7-4fad-8686-3506521061f9","html_url":"https://github.com/dylibso/hermit","commit_stats":null,"previous_names":["dylibso/hermit"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/dylibso/hermit","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dylibso%2Fhermit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dylibso%2Fhermit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dylibso%2Fhermit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dylibso%2Fhermit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dylibso","download_url":"https://codeload.github.com/dylibso/hermit/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dylibso%2Fhermit/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261217237,"owners_count":23126245,"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","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":["compiler","container","cosmopolitan-libc","cross-platform","wasm"],"created_at":"2024-12-13T10:13:30.420Z","updated_at":"2025-09-22T09:20:05.514Z","avatar_url":"https://github.com/dylibso.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"![Hermit - Actually Portable WebAssembly](./.github/readme-header.jpg)\n\n# Hermit\n\nA toolkit for creating Actually Portable WASM Executables, called hermits. See\n[blogpost](https://dylibso.com/blog/hermit-actually-portable-wasm).\n\n## Download\n\nSee [releases](https://github.com/dylibso/hermit/releases).\n\n## Usage\n\n`./hermit.com [-f \u003cpath_to_Hermitfile\u003e] [-o \u003coutput_path\u003e]`\n\nIf a path to a `Hermitfile` is not provided, it tries to load `Hermitfile` from\nthe current directory. If an `output_path` is not provided, the hermit is\nwritten to `wasm.com` in the current directory. On Unix-like operating systems\nyou must `chmod +x wasm.com` to make it executable. This is required because\nWASI does not have a `chmod` function.\n\n\u003e Note: you may need to call `hermit.com` and its resulting hermits using `sh`\n\u003e as such:\n\n```sh\nsh ./hermit.com\n```\n\nOn ARM / Apple Silicon:\n\n```sh\narch -x86_64 ./uuid.com  \n\n# or, possibly needed to run with `sh`:\narch -x86_64 sh ./uuid.com\n```\n\n### On the `.com` extension...\n\nHermit takes advantage of the\n[Cosmopoliltan Libc](https://github.com/jart/cosmopolitan) and produces\nmulti-platform X86_64 binary executables (called\n[αcτµαlly pδrταblε εxεcµταblε](https://justine.lol/ape.html), or \"APE\"s for\nshort). While Unix-like systems do not care about the extension, certain Windows\nenvironments require that an extension is used. Remove it if you'd like, but it\nmust be present for the same executable to be run on Windows.\n\n## Hermitfile syntax\n\n### Supported:\n\n- `FROM \u003cpath_to_wasm_without_quotes\u003e` - mandatory, instructs the hermit CLI\n  what Wasm module to use. Path can be relative to the location of the\n  `Hermitfile`.\n- `MAP \u003c[paths]\u003e` - maps an array of directories (and their subdirectories) into\n  the WASI filesystem used by the Wasm module.You cannot map the `.` and `/` at\n  the same time, see `ENV_PWD_IS_HOST_CWD`.\n- `ENV KEY=VALUE` - declares an environment variable for the Wasm. Can be used\n  multiple times or provided multiple K=V pairs on a single line separated by a\n  whitespace.\n- `ENV_PWD_IS_HOST_CWD` - passes the current working directory on the host into\n  the Wasm via the environment variable `$PWD`. This works around a limitation\n  in WASI that there's no way to initialize the current working directory when\n  combined with adding `chdir(getenv(\"PWD\"))` or equivalent into the beginning\n  of your Wasm program.\n- `ENV_EXE_NAME_IS_HOST_EXE_NAME` - passes the path to the currently running\n  executable into the Wasm via the environment variable `EXE_NAME`. This was\n  implemented to enable implementing the hermit CLI as a hermit.\n\n### Unimplemented:\n\n- `NET \u003c[hostnames]\u003e` - takes an array of hostnames used to configure an\n  allowlist of outbound connections.\n\n- `LINK \u003c[wasm]\u003e` - takes a list of Wasm module locations (file paths, URLs,\n  etc) to link with the main Wasm module defined in `FROM`.\n\n## Limitations\n\n- Currently only uses WAMR's interpreter mode.\n  - Wasm runs slow\n  - Wasm with SIMD is unsupported\n- In order for the Wasm to inherit the current directory from the host, it must\n  set it itself, possibly using `ENV_PWD_IS_HOST_CWD` and loading from `$PWD`.\n- Network isn't implemented yet. WAMR has support so it probably isn't a hard\n  change.\n- External functionality is limited to what WASI supports.\n- Only x86_64 supported right now, but it probably could be extended to use\n  `fatcosmocc` instead of `cosmocc`.\n\n## Building\n\n### Setup\n\n1. Clone with submodules so you get WAMR and the forked dockerfile-parser-rs\n   (the hermitfile parser)\n\n   `git clone --recurse-submodules git@github.com:dylibso/hermit.git`\n\n2. Bootstrap pest (dockerfile-parser-rs dependency):\n\n   `cd dockerfile-parser-rs/third-party/pest \u0026\u0026 cargo build --package pest_bootstrap`\n\n3. Clone the Cosmopolitan libc and setup `cosmocc` as mentioned in\n   [Getting Started](https://github.com/jart/cosmopolitan/#getting-started). If\n   `cosmocc` isn't in your `PATH` after adding a new shell, maybe append to\n   `.bashrc` instead.\n\n### Build\n\n`./build_hermit.sh` configures and builds with cmake to the `build` dir.\n\n### Demo hermits\n\nAfter building, try out:\n\n`./build/cowsay.hermit.com 'Hello, Dylibso!'`\n\nor\n\n`echo aeiou | ./build/count_vowels.hermit.com`\n\n## Benchmarks\n\n- Hermit-cli : `./benchmarks/bench-cli.sh` benchmark hermit cli, for more details check [docs](benchmarks/README.md).\n- Cli binaries produced by Hermit-cli : `./benchmarks/bench-artifacts.sh` benchmark produced binaries, for more details check [docs](benchmarks/README.md).\n\n## Community\n\nHermit shares the [Extism Discord](https://discord.gg/cx3usBCWnc). Join `#hermit` to discuss working with or building Hermit.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdylibso%2Fhermit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdylibso%2Fhermit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdylibso%2Fhermit/lists"}