{"id":13992314,"url":"https://github.com/klaaspieter/chxcode","last_synced_at":"2025-02-26T11:22:51.587Z","repository":{"id":42695030,"uuid":"129905426","full_name":"klaaspieter/chxcode","owner":"klaaspieter","description":"Changes the current Xcode","archived":false,"fork":false,"pushed_at":"2022-03-28T06:51:06.000Z","size":100,"stargazers_count":68,"open_issues_count":2,"forks_count":2,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-01-09T04:17:58.634Z","etag":null,"topics":["xcode"],"latest_commit_sha":null,"homepage":null,"language":"Makefile","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/klaaspieter.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}},"created_at":"2018-04-17T13:02:13.000Z","updated_at":"2023-10-06T22:04:11.000Z","dependencies_parsed_at":"2022-08-23T23:01:53.356Z","dependency_job_id":null,"html_url":"https://github.com/klaaspieter/chxcode","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/klaaspieter%2Fchxcode","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/klaaspieter%2Fchxcode/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/klaaspieter%2Fchxcode/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/klaaspieter%2Fchxcode/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/klaaspieter","download_url":"https://codeload.github.com/klaaspieter/chxcode/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240841138,"owners_count":19866329,"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":["xcode"],"created_at":"2024-08-09T14:01:55.987Z","updated_at":"2025-02-26T11:22:51.477Z","avatar_url":"https://github.com/klaaspieter.png","language":"Makefile","funding_links":[],"categories":["Makefile"],"sub_categories":[],"readme":"# chxcode \n![Build Status](https://github.com/klaaspieter/chxcode/workflows/ci/badge.svg)\n\nChanges the current Xcode.\n\n## Installation\n\n```sh\nbrew tap klaaspieter/formula\nbrew install chxcode\n```\n\n## Usage\n\nWith the following in your `.bashrc`, `.zshrc` file:\n\n```sh\nsource /usr/local/share/chxcode/chxcode\n```\n\nList available Xcodes:\n\n```sh\n$ chxcode\n  9.2\n  9.3\n  9.4\n```\n\nSelect Xcode for the current shell:\n\n```sh\n$ chxcode 9.3\n$ chxcode\n  9.2\n* 9.3\n  9.4\n$ echo \"$DEVELOPER_DIR\"\n/Applications/Xcode-9.3.app/Contents/Developer\n```\n\n## Auto-switching\n\nTo automatically switch the current Xcode version when you `cd` between different directories, load `auto` in `~/.bashrc` or `~/.zshrc`.\n\n### Intel\n\n```sh\nsource /usr/local/share/chxcode/chxcode\nsource /usr/local/share/chxcode/auto\n```\n\n### Apple Silicon\n\n```sh\nsource /opt/homebrew/opt/share/chxcode/chxcode\nsource /opt/homebrew/opt/share/chxcode/auto\n```\n\n(If you're unsure then simply follow the instructions Homebrew showed you after installation. Run `brew info chxcode` to see the instructions again.)\n\n`auto` looks for an `.xcode-version` file and automatically selects that version for the current folder and any of it's subfolders.\n\nFor example:\n\n```sh\n$ xcode-select -p\n/Applications/Xcode-9.4.app/Contents/Developer\n$ chxcode\n  9.2\n  9.3\n* 9.4\n$ echo \"9.3\" \u003e project/.xcode-version\n$ cd project\n$ xcode-select -p\n/Applications/Xcode-9.3.app/Contents/Developer\n$ chxcode\n  9.2\n* 9.3\n  9.4\n```\n\n## Xcodes\n\nWhen `chxcode` is sourced it auto-detects installed Xcodes. After installing a new Xcode you _must_ restart the shell before chxcode can find them.\n\n## How it works\n\n`chxcode` uses Spotlight (through `mdfind`) to search for the `com.apple.dt.Xcode` bundle identifier. It then uses `mdls` to find the Xcode version. Switching Xcodes is done by setting the `DEVELOPER_DIR` environment variable.\n\n`man xcode-select` on the `DEVELOPER_DIR` environment variable:\n\u003e Overrides the active developer directory. When DEVELOPER_DIR is set, its value will be used instead of the system-wide active developer directory.\n\n## Test\n\nWith [shunit2] installed, run:\n\n```sh\n$ ./test/runner\n```\n\nTo run individual test files:\n\n```sh\n# Interactive shell\nzsh -i test/[name]_test\nbash -i test/[name]_test\n\n# Non-interactive shell\nzsh test/[name]_test\nbash test/[name]_test\n```\n\n[shunit2]: https://github.com/kward/shunit2\n\n## Acknowledgements\n\n- [postmodern] for [chruby]\n\n[postmodern]: https://github.com/postmodern\n[chruby]: https://github.com/postmodern/chruby\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fklaaspieter%2Fchxcode","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fklaaspieter%2Fchxcode","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fklaaspieter%2Fchxcode/lists"}