Skip to content

build: improve Apple Intelligence detection#927

Open
AlexanderYastrebov wants to merge 1 commit intocjpais:mainfrom
AlexanderYastrebov:improve-apple-intelligence-detection
Open

build: improve Apple Intelligence detection#927
AlexanderYastrebov wants to merge 1 commit intocjpais:mainfrom
AlexanderYastrebov:improve-apple-intelligence-detection

Conversation

@AlexanderYastrebov
Copy link

@AlexanderYastrebov AlexanderYastrebov commented Mar 1, 2026

Check for existence of the dynamic library.

On my machine (Sequoia 15.7.3, 26.2 SDK, Xcode CLI tools) I only have library stub:

% ls -1 $(xcrun --sdk macosx --show-sdk-path)/System/Library/Frameworks/FoundationModels.framework/
FoundationModels.tbd
Modules
Versions

which does not allow me to build Handy as swiftc fails to compile. Looks like FoundationModels require full Xcode installation.

Before Submitting This PR

Please confirm you have done the following:

If this is a feature or change that was previously closed/rejected:

  • I have explained in the description below why this should be reconsidered
  • I have gathered community feedback (link to discussion below)

Human Written Description

Related Issues/Discussions

Fixes #
Discussion:

Community Feedback

Testing

Screenshots/Videos (if applicable)

AI Assistance

  • No AI was used in this PR
  • AI was used (please describe below)

If AI was used:

  • Tools used:
  • How extensively:

Check for existence of the dynamic library.

On my machine (26.2 SDK, Xcode CLI tools) I only have library stub:
```console
% ls -1 $(xcrun --sdk macosx --show-sdk-path)/System/Library/Frameworks/FoundationModels.framework/
FoundationModels.tbd
Modules
Versions
```
which does not allow me to build Handy as swiftc fails to compile.
Looks like FoundationModels require full Xcode installation.
Path::new(&sdk_path).join("System/Library/Frameworks/FoundationModels.framework");
let has_foundation_models = framework_path.exists();
let framework_lib =
Path::new(&sdk_path).join("System/Library/Frameworks/FoundationModels.framework/FoundationModels.dylib");
Copy link
Author

Choose a reason for hiding this comment

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

I can not test it as I don't have full Xcode installation.
@Schreezer @cjpais Could you please check that you have dylib:

stat $(xcrun --sdk macosx --show-sdk-path)/System/Library/Frameworks/FoundationModels.framework/FoundationModels.dylib

Copy link
Contributor

Choose a reason for hiding this comment

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

Your fix breaks the build for the users who have the foundational models installed, can you please try running this code on your machine:
import Foundation
import FoundationModels

if #available(macOS 26.0, *) {
let model = SystemLanguageModel.default
switch model.availability {
case .available:
print("✅ Apple Intelligence is AVAILABLE!")
case .unavailable(let reason):
print("❌ Apple Intelligence is unavailable: (reason)")
@unknown default:
print("❓ Unknown availability state")
}
} else {
print("❌ macOS 26.0+ required")
}

Copy link
Author

Choose a reason for hiding this comment

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

@Schreezer

Hi, I can not build Handy at all (and likely will not be able to build that snippet due to #available(macOS 26.0, *)), intelligence is likely unavailable since I use Sequoia 15.7.3 but have 26.2 SDK installed. Could you please share file list of the $(xcrun --sdk macosx --show-sdk-path)/System/Library/Frameworks/FoundationModels.framework/ - I am wondering if we can use dylib file or something else instead of checking directory presence to detect intelligence support.

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