Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
CatMe0w committed Jun 17, 2024
0 parents commit 7969653
Show file tree
Hide file tree
Showing 5 changed files with 100 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.DS_Store
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 CatMe0w

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
38 changes: 38 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# zouxian 走线

Apple restricted the access to Xcode LLM (Predictive Code Completion) feature on China models of Mac. That is, if you are using a Mac bought in China, even if you are not in China, you will not be able to use Predictive Code Completion.

If you are unfortunate to be in this situation, now it is time take your Mac on a journey of _[Zouxian](https://en.wikipedia.org/wiki/Zouxian_(phenomenon))_.

---

Persistent solution after rebooting, based on [unixzii's guide](https://gist.github.com/unixzii/6f25be1842399022e16ad6477a304286). 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.**

# Install

```powershell
brew install catme0w/tap/zouxian
sudo brew services start zouxian
```

> Check out [the formula](https://github.com/CatMe0w/homebrew-tap/blob/main/Formula/zouxian.rb) if you're interested
# Uninstall

```powershell
sudo brew services stop zouxian
brew uninstall zouxian
```

# License

MIT License
16 changes: 16 additions & 0 deletions cat.me0w.zouxian.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>cat.me0w.zouxian</string>
<key>ProgramArguments</key>
<array>
<string>/usr/local/bin/zouxian</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>KeepAlive</key>
<false/>
</dict>
</plist>
24 changes: 24 additions & 0 deletions zouxian.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/bash

MAX_WAIT_TIME=60
CHECK_INTERVAL=1
SECONDS_PASSED=0

while [ $SECONDS_PASSED -lt $MAX_WAIT_TIME ]; do
PID=$(pgrep eligibilityd)
if [ ! -z "$PID" ]; then
echo "eligibilityd found with PID $PID"
lldb --batch \
-o "process attach --name eligibilityd" \
-o "expression (void) [[[InputManager sharedInstance] objectForInputValue:6] setValue:@\"US\" forKey:@\"_deviceRegionCode\"]" \
-o "expression (void) [[EligibilityEngine sharedInstance] recomputeAllDomainAnswers]" \
-o "process detach" \
-o quit || { echo "lldb command failed"; exit 1; }
exit 0
fi
sleep $CHECK_INTERVAL
SECONDS_PASSED=$((SECONDS_PASSED + CHECK_INTERVAL))
done

echo "eligibilityd not found after $MAX_WAIT_TIME seconds"
exit 1

0 comments on commit 7969653

Please sign in to comment.