{"id":24823334,"url":"https://github.com/kukushechkin/openinterminalbutton","last_synced_at":"2026-05-05T14:32:13.198Z","repository":{"id":230623482,"uuid":"779782671","full_name":"kukushechkin/OpenInTerminalButton","owner":"kukushechkin","description":"A tiny SwiftPM package that provides a library and a SwiftUI button for opening a folder in macOS Terminal.app or iTerm2.app.","archived":false,"fork":false,"pushed_at":"2024-03-31T12:31:21.000Z","size":15,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-04-23T01:39:18.199Z","etag":null,"topics":["macos","swift","swiftui","terminal"],"latest_commit_sha":null,"homepage":"","language":"Swift","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/kukushechkin.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}},"created_at":"2024-03-30T19:19:37.000Z","updated_at":"2024-08-28T05:14:02.000Z","dependencies_parsed_at":"2024-03-30T23:22:19.799Z","dependency_job_id":"28a4cc2e-e6e4-465a-a226-13c721fd8715","html_url":"https://github.com/kukushechkin/OpenInTerminalButton","commit_stats":null,"previous_names":["kukushechkin/openinterminalbutton"],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/kukushechkin/OpenInTerminalButton","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kukushechkin%2FOpenInTerminalButton","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kukushechkin%2FOpenInTerminalButton/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kukushechkin%2FOpenInTerminalButton/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kukushechkin%2FOpenInTerminalButton/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kukushechkin","download_url":"https://codeload.github.com/kukushechkin/OpenInTerminalButton/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kukushechkin%2FOpenInTerminalButton/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32653510,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-05T11:29:49.557Z","status":"ssl_error","status_checked_at":"2026-05-05T11:29:48.587Z","response_time":54,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5: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":["macos","swift","swiftui","terminal"],"created_at":"2025-01-30T19:57:52.219Z","updated_at":"2026-05-05T14:32:13.182Z","avatar_url":"https://github.com/kukushechkin.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![](https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2Fkukushechkin%2FOpenInTerminalButton%2Fbadge%3Ftype%3Dswift-versions)](https://swiftpackageindex.com/kukushechkin/OpenInTerminalButton)\n[![](https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2Fkukushechkin%2FOpenInTerminalButton%2Fbadge%3Ftype%3Dplatforms)](https://swiftpackageindex.com/kukushechkin/OpenInTerminalButton)\n\n# OpenInTerminalButton\n\nA tiny SwiftPM package that provides a library and a SwiftUI button for opening a folder in macOS Terminal.app or iTerm2.app.\n\n## Comptbitility\n\nFor obvious reasons, this package is macOS-only. \nApple Events can be used in sandbox only with a temporary exception, but even if you manage to get one,\nthat app will, most probably, [not pass the App Store review process](https://developer.apple.com/forums/thread/663311?answerId=639603022#639603022).\n\n## Public interface\n\n- `struct OpenInTerminalButton: View` - a SwiftUI button that opens the current Finder window in Terminal.app or iTerm2.app.\n- `struct BorderlessButton: View` - a SwuftUI button without a border and background.\n- `enum OpenInTerminalError` — an enumeration of possible errors.\n- `enum SupportedTerminal` — an enumeration of possible terminal applications.\n- `func openInTerminal(location: URL, commands: [String]?) async throws -\u003e Result\u003cSupportedTerminal, OpenInTerminalError\u003e` — a function that opens the specified location in Terminal.app or iTerm2.app and runs the specified commands.\n\n## Usage\n\n1. Add a dependency in your `Package.swift`:\n\n```swift\n.package(url: \"https://github.com/kukushechkin/OpenInTerminalButton\", .upToNextMajor(from: \"1.0.0\"))\n```\n\n2. Add Apple Events to the `Info.plist` of your app:\n\n```xml\n\u003ckey\u003eNSAppleEventsUsageDescription\u003c/key\u003e\n\u003cstring\u003eAllow this app to open terminal app and execute commands.\u003c/string\u003e \n```\n\n3. Use the `OpenInTerminalButton` view:\n\n```swift\nimport SwiftUI\nimport OpenInTerminalButton\n\nstruct ContentView: View {\n    var body: some View {\n        OpenInTerminalButton(\n            location: URL(fileURLWithPath: \"~/Desktop\"),\n            commands: [\n                \"echo 'Hello, world!'\",\n                \"ls -la\"\n            ]\n        )\n    }\n}\n```\n\nAfter clicking on the button, a new iTerm2.app (if installed) or Terminal window will open with the specified commands.\nIf you're using Hotkey Window in iTerm2.app, a new tab will open in the existing window.\n\n4. Use `openInTerminal(location:commands:)` function directly, for example if you would like to create a custom button:\n\n```swift\nimport OpenInTerminalButton\n\nlet result = openInTerminal(location: URL(fileURLWithPath: \"~/Desktop\"), commands: [\"echo 'Hello, world!'\"])\nswitch result {\ncase .success(let terminal):\n    print(\"Opened in \\(terminal)\")\ncase .failure(let error):\n    print(\"Error: \\(error)\")\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkukushechkin%2Fopeninterminalbutton","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkukushechkin%2Fopeninterminalbutton","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkukushechkin%2Fopeninterminalbutton/lists"}