在 macOS 26 中,会使用多种方式检测当前所在的国家或地区,可按下面的步骤来修改并锁定位置:
切换至 root 用户
sudo -i
进入目录
cd /private/var/db/com.apple.countryd
修改文件权限
sudo chmod 777 countryCodeCache.plist
编辑文件
vi countryCodeCache.plist
如果乱码,执行下面的命令,然后重新编辑
plutil -convert xml1 countryCodeCache.plist
锁定文件
chflags uchg countryCodeCache.plist
如果要解锁文件,使用以下命令:
chflags nouchg countryCodeCache.plist