Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

apple-sdk: support reading path set by xcode-select --switch #154

Closed
wants to merge 1 commit into from

Conversation

madsmtm
Copy link
Contributor

@madsmtm madsmtm commented Aug 19, 2024

The user can set the current developer directory globally by using xcode-select --switch PATH.

This creates a symlink at /var/db/xcode_select_link, which we can read to get the path of the current globally configured developer directory. In the past, other files were created instead, so we also attempt to read those (we could probably omit this logic, but might as well include it for completeness).

I'm fairly confident that this is the last thing needed for SdkSearch::default() to perform exactly the same lookup as xcode-select --print-path itself.

See also rust-lang/rust#131433 where I implemented similar logic in rustc.

`xcode-select --switch PATH` creates a symlink at
`/var/db/xcode_select_link`, which we can read to get the path of the
current globally configured developer directory.
@madsmtm madsmtm force-pushed the xcode-select-paths branch from aa6e32f to 72c9fc7 Compare August 19, 2024 18:29
@madsmtm
Copy link
Contributor Author

madsmtm commented Aug 21, 2024

I have since making this become aware that /usr/share/xcode-select is protected by SIP, so it’s likely only used internally for development - I'll do the work to remove it from the PR if there is desire to land this?

Copy link
Owner

@indygreg indygreg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR is perfect. Thank you very much!

I'll rebase the merge conflict locally and push outside of GitHub. The PR will be marked as closed instead of merged momentarily.

@indygreg indygreg closed this in 5fb3af6 Nov 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants