Skip to content

Instantly share code, notes, and snippets.

@unixzii
Last active June 26, 2024 11:38
Show Gist options
  • Save unixzii/6f25be1842399022e16ad6477a304286 to your computer and use it in GitHub Desktop.
Save unixzii/6f25be1842399022e16ad6477a304286 to your computer and use it in GitHub Desktop.
A guide to force enabling Xcode LLM feature on China-SKU Macs.

Introduction

Apple restricted the access to Xcode LLM (Predictive code completion) feature on China models of Mac. This guide provides a way to bypass that restriction. It's verified on macOS 15.0 Beta (24A5264n), but there is no guarentee that it will always work on later macOS versions.

Prerequisites

  • Xcode is installed and run at least once.
  • SIP debugging restrictions are disabled (via csrutil enable --without debug command in recovery mode).

Disclaimer

Disabling SIP can cause some unknown effect. And for now, Xcode LLM is not stable and may cause kernel panics, which will lose some of your document modifications. Please use with caution.

Bypass Steps

1. Attach to eligibilityd using LLDB

$ sudo lldb

Then execute the below command in LLDB console:

(lldb) process attach --name eligibilityd

It should stop the main thread of eligibilityd process and show a (lldb) prompt if successful.

2. Modify the device region

(lldb) e (void) [[[InputManager sharedInstance] objectForInputValue:6] setValue:@"US" forKey:@"_deviceRegionCode"]

3. Recompute the domain answers

(lldb) e (void) [[EligibilityEngine sharedInstance] recomputeAllDomainAnswers]

4. Verify the domain answer (Optional)

You can check whether the operation is effective by executing:

(lldb) po [[[[EligibilityEngine sharedInstance] domains] objectForKey:@"OS_ELIGIBILITY_DOMAIN_XCODE_LLM"] answer]

If it prints 0x0000000000000004 then it's all good.

5. Detach the process and exit LLDB

(lldb) process detach
(lldb) exit

6. Restart Xcode and enjoy!

Acknowledgement

Thanks for those who make this possible together: Lakr233, Sou1gh0st, Yuriko.

@crazypoo
Copy link

omg mymac show this error:attach failed: debugserver is x86_64 binary running in translation, attach failed.

@roiiiu
Copy link

roiiiu commented Jun 18, 2024

image 可用,感谢🙏

@DargonLee
Copy link

image 可用,感谢🙏

你是 macOS 15 吗

@roiiiu
Copy link

roiiiu commented Jun 18, 2024

image 可用,感谢🙏

你是 macOS 15 吗

是的 需要升级到15才能用

@rggsix
Copy link

rggsix commented Jun 18, 2024

👏🏻👏🏻👏🏻

@Snsaiu
Copy link

Snsaiu commented Jun 18, 2024

使用稳定吗

@mumuWorld
Copy link

omg mymac show this error:attach failed: debugserver is x86_64 binary running in translation, attach failed.

me too, How to solve this situation

@crazypoo
Copy link

omg mymac show this error:attach failed: debugserver is x86_64 binary running in translation, attach failed.

me too, How to solve this situation

sip disable again

@dluffymonkey
Copy link

请问一下,想买新的mac,美版的没渠道买,港版的可以直接使用AI功能吗,再也不买国行的了,去香港买的,需要做这些处理吗

@MacsedProtoss
Copy link

请问一下,想买新的mac,美版的没渠道买,港版的可以直接使用AI功能吗,再也不买国行的了,去香港买的,需要做这些处理吗

According to The Apple Wiki - Eligibility
it only restricts China sku which has a region code “CH”
You can find out more region codes here The Apple Wiki - Model Regions.
The region code for models sold in Hongkong is “ZP”, differentiating from those sold in mainland China.

@dluffymonkey
Copy link

请问一下,想买新的mac,美版的没渠道买,港版的可以直接使用AI功能吗,再也不买国行的了,去香港买的,需要做这些处理吗

According to The Apple Wiki - Eligibility根据苹果维基 - 资格 it only restricts China sku which has a region code “CH”它只限制区域代码为 "CH "的中国产品。 You can find out more region codes here The Apple Wiki - Model Regions.您可以在 The Apple Wiki - Model Regions 了解更多地区代码。 The region code for models sold in Hongkong is “ZP”, differentiating from those sold in mainland China.在香港销售的机型的地区代码为 "ZP",以区别于在中国大陆销售的机型。

好的,非常感谢您的解答,港版的Mac还是比较好买到的,美版买不到就买港版的吧,反正是不买国行了

@ChinaHarry23
Copy link

Screenshot 2024-06-23 at 8 28 47 AM it works like a charm, cheers

@ChinaHarry23
Copy link

I'm guessing all AI annoucement will be unrelated for us the Chinese people

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment