├── .gitignore ├── LICENSE ├── OSHelper_Beta.sh ├── OSHelper_Stable.sh ├── README.md ├── README_EN.md └── assets ├── example1.gif ├── example2.gif ├── example3.gif └── logo.jpg /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | .DS_Store 3 | .DS_Store 4 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 MingS 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /OSHelper_Beta.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | RED="\033[31m" 3 | BLUE="\033[34m" 4 | NC="\033[0m" 5 | echo '====欢迎使用macOS Helper Shell====' 6 | echo '😁由Ligure Studio团队维护,基于 MIT LICENSE 开源。' 7 | echo '👍开源地址:https://github.com/Ligure-Studio/macOSHelperShell' 8 | echo '❗️为保证功能顺利运行,请在出现Password提示时输入您电脑的开机密码(密码不会在界面上显示)' 9 | echo -e "${RED} 0.1.1-beta4(classified-unstable) ${NC}" 10 | echo '------------------------------' 11 | sleep 1 12 | # === 开始定义安装 Xcode CLT 函数 === 13 | 14 | function isXcodeCLT() { 15 | if [ $yOrNot == "y" ] || [ $yOrNot == "Y" ]; then 16 | echo '⏩开始安装Xcode CLT' 17 | xcode-select --install 18 | echo '👌🏻理论上来讲你应该已经安装成功了,或者你已经安装过了(报error: command line tools are already installed错误).' 19 | echo '🤔如果报其他错(error),那多半是网络问题,请访问 https://developer.apple.com/download/all/ 登录您的Apple ID,然后手动下载.😁' 20 | echo '😀请再次尝试安装Homebrew.' 21 | else 22 | echo '❎将不会安装Xcode CLT和Homebrew' 23 | fi 24 | } 25 | # function testCLT() { 26 | # echo "❌您没有安装Xcode CLT,是否安装Xcode CLT?(y/n)" 27 | # read yOrNot 28 | # isXcodeCLT 29 | # } 30 | # === 结束定义安装 Xcode CLT 函数 === 31 | 32 | # ===安装Homebrew函数=== 33 | 34 | function installBrew { 35 | echo '❓首先我们要检测你是否安装Xcode CLT.' 36 | if xcode-select -p &> /dev/null; then 37 | echo "✅你已经安装了Xcode CLT.接下来我们将为您安装Homebrew.😁" 38 | export HOMEBREW_BREW_GIT_REMOTE="https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git" 39 | export HOMEBREW_CORE_GIT_REMOTE="https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git" 40 | export HOMEBREW_BOTTLE_DOMAIN="https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles" 41 | echo '👍默认已进行换源' 42 | git clone --depth=1 https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/install.git brew-install 43 | /bin/bash brew-install/install.sh 44 | rm -rf brew-install 45 | export HOMEBREW_BREW_GIT_REMOTE="https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git" 46 | brew update 47 | export HOMEBREW_CORE_GIT_REMOTE="https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git" 48 | for tap in core cask{,-fonts,-drivers,-versions} command-not-found; do 49 | brew tap --custom-remote --force-auto-update "homebrew/${tap}" "https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-${tap}.git" 50 | done 51 | brew update 52 | test -r ~/.bash_profile && echo 'export HOMEBREW_BREW_GIT_REMOTE="https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git"' >> ~/.bash_profile # bash 53 | test -r ~/.bash_profile && echo 'export HOMEBREW_CORE_GIT_REMOTE="https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git"' >> ~/.bash_profile 54 | test -r ~/.profile && echo 'export HOMEBREW_BREW_GIT_REMOTE="https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git"' >> ~/.profile 55 | test -r ~/.profile && echo 'export HOMEBREW_CORE_GIT_REMOTE="https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git"' >> ~/.profile 56 | 57 | test -r ~/.zprofile && echo 'export HOMEBREW_BREW_GIT_REMOTE="https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git"' >> ~/.zprofile # zsh 58 | test -r ~/.zprofile && echo 'export HOMEBREW_CORE_GIT_REMOTE="https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git"' >> ~/.zprofile 59 | else 60 | echo "❌您没有安装Xcode CLT,是否安装Xcode CLT?(y/n)" 61 | read yOrNot 62 | isXcodeCLT 63 | fi 64 | } 65 | 66 | #===安装Homebrew函数结束=== 67 | 68 | #===系统功能函数=== 69 | 70 | function OSFunction { 71 | echo '[1].开启"全部来源"' 72 | echo '[2].关闭"全部来源"' 73 | echo '[3].清除软件隔离属性(解决"已损坏"问题)' 74 | echo '[4].开启/关闭通过刷指纹验证sudo' 75 | echo '[5].将Dock栏恢复出厂设置' 76 | echo '[6].刷新缩略图(适用于缩略图被抢)' 77 | echo '[7].下载macOS' 78 | echo '[8].制作macOS可引导安装盘(没写完)' 79 | echo '[9].修改截图保存的默认类型' 80 | echo '[n].退出' 81 | read OSInputNumber #OS部分输入参数 82 | if [ "$OSInputNumber" == '1' ] 83 | then 84 | sudo spctl --master-disable 85 | echo '✅已完成' 86 | elif [ "$OSInputNumber" == '2' ] 87 | then 88 | sudo spctl --master-enable 89 | echo '✅已完成' 90 | elif [ "$OSInputNumber" == '3' ] 91 | then 92 | echo '😀请输入软件路径(可将软件拖进终端)👉' 93 | read appPath 94 | sudo xattr -r -d com.apple.quarantine $appPath 95 | echo '✅已完成' 96 | elif [ "$OSInputNumber" == '4' ] 97 | then 98 | echo '😀正在检测是否已经开启本功能……' 99 | status=$(sudo cat /etc/pam.d/sudo) 100 | if [[ $status == *"pam_tid.so"* ]]; then 101 | echo "🤔似乎已开启该功能, 是否需要关闭?(y/n)" 102 | read yOrNot 103 | if [ $yOrNot == "y" ] || [ $yOrNot == "Y" ]; then 104 | sed -i '' "/pam_tid.so/d" /etc/pam.d/sudo 105 | echo '✅已关闭' 106 | else 107 | echo '❎将不会关闭' 108 | fi 109 | else 110 | echo "👌没有开启该功能, 正在开启……" 111 | sudo sed '1i auth sufficient pam_tid.so' /etc/pam.d/sudo 112 | echo "✅已打开" 113 | fi 114 | elif [ "$OSInputNumber" == '5' ] 115 | then 116 | echo '⚠️ 你真的确认要操作吗?' 117 | echo '⚠️ 操作后Dock将重置为出厂设置且无法恢复!' 118 | echo '🤔是否仍然执行?(y/n)' 119 | read yOrNot 120 | if [ $yOrNot == "y" ] || [ $yOrNot == "Y" ]; then 121 | defaults delete com.apple.dock; killall Dock 122 | echo '✅已完成' 123 | else 124 | echo '❎将不会重置Dock' 125 | fi 126 | elif [ "$OSInputNumber" == '6' ] 127 | then 128 | sudo find /private/var/folders/ \( -name com.apple.dock.iconcache -or -name com.apple.iconservices \) -exec rm -rfv {} \; 129 | sudo rm -rf /Library/Caches/com.apple.iconservices.store; 130 | killall Dock 131 | killall Finder 132 | echo '✅已完成' 133 | elif [ "$OSInputNumber" == '7' ] 134 | then 135 | echo '选择系统版本后将会打开App Store,您可自行点击“获取”进行下载。' 136 | echo '请选择你要下载的版本(过于老旧的版本此处不提供):' 137 | sleep 1 138 | echo '[1].Ventura 13' 139 | echo '[2].Monterey 12' 140 | echo '[3].Big Sur 11' 141 | echo '[4].Catalina 10.15' 142 | echo '[5].Mojave 10.14' 143 | echo '[6].High Sierra 10.13' 144 | echo '[n].退出' 145 | read OSVerNumber 146 | if [ "$OSVerNumber" == '1' ];then 147 | open 'macappstores://apps.apple.com/app/macos-ventura/id1638787999' 148 | OSFunction 149 | elif [ "$OSVerNumber" == '2' ];then 150 | open 'macappstores://apps.apple.com/app/macos-monterey/id1576738294' 151 | OSFunction 152 | elif [ "$OSVerNumber" == '3' ];then 153 | open 'macappstores://apps.apple.com/app/macos-big-sur/id1526878132' 154 | OSFunction 155 | elif [ "$OSVerNumber" == '4' ];then 156 | open 'macappstores://apps.apple.com/app/macos-catalina/id1466841314' 157 | OSFunction 158 | elif [ "$OSVerNumber" == '5' ];then 159 | open 'macappstores://apps.apple.com/app/macos-mojave/id1398502828' 160 | OSFunction 161 | elif [ "$OSVerNumber" == '6' ];then 162 | open 'macappstores://apps.apple.com/app/macos-high-sierra/id1246284741' 163 | OSFunction 164 | elif [ "$OSVerNumber" == 'n' ];then 165 | OSFunction 166 | else 167 | echo '❌输入错误!' 168 | fi 169 | elif [ "$OSInputNumber" == '8' ];then 170 | echo '⚠️ 使用此功能需要先下载相应版本的macOS,如果您没下载,请重进脚本,使用“一般系统功能”→“[7].下载macOS”功能进行下载。' 171 | echo '⚠️ 您需要准备一个至少14GB的U盘,且一旦开始制作,您U盘里的所有数据就会全部清空,请慎重决定!' 172 | echo '没搞完,睡觉了😴' 173 | elif [ "$OSInputNumber" == '9' ];then 174 | echo '⚠️ 请选择你需要修改的图片类型(默认格式是png)' 175 | echo '[1].bmp' 176 | echo '[2].jpg' 177 | echo '[3].jpeg' 178 | echo '[4].gif' 179 | echo '[5].png' 180 | echo '[6].pdf' 181 | echo '[7].tiff' 182 | echo '[n/N].退出' 183 | read imgInputNumber 184 | if [ "${imgInputNumber}" == '1' ]; then 185 | defaults write com.apple.screencapture type bmp;killall SystemUIServer && echo '✅ 已修改完成' 186 | elif [ "${imgInputNumber}" == '2' ]; then 187 | defaults write com.apple.screencapture type jpg;killall SystemUIServer && echo "✅ 已修改完成" 188 | elif [ "${imgInputNumber}" == '3' ]; then 189 | defaults write com.apple.screencapture type jpeg;killall SystemUIServer && echo '✅ 已修改完成' 190 | elif [ "${imgInputNumber}" == '4' ]; then 191 | defaults write com.apple.screencapture type gif;killall SystemUIServer && echo '✅ 已修改完成' 192 | elif [ "${imgInputNumber}" == '5' ]; then 193 | defaults write com.apple.screencapture type png;killall SystemUIServer && echo '✅ 已修改完成' 194 | elif [ "${imgInputNumber}" == '6' ]; then 195 | defaults write com.apple.screencapture type pdf;killall SystemUIServer && echo '✅ 已修改完成' 196 | elif [ "${imgInputNumber}" == '7' ]; then 197 | defaults write com.apple.screencapture type tiff;killall SystemUIServer && echo '✅ 已修改完成' 198 | elif [ "${imgInputNumber}" == 'n' ]; then 199 | OSFunction 200 | else 201 | echo '❌输入错误!' 202 | fi 203 | elif [ "$OSInputNumber" == 'n' ] 204 | then 205 | main 206 | else 207 | echo '❌输入错误!' 208 | fi 209 | } 210 | 211 | #===系统功能函数结束=== 212 | 213 | 214 | #===常用开发库安装函数=== 215 | 216 | function devTools { 217 | echo '[1].安装Xcode CLT(因国内网络问题,可能等待时间较长或安装失败)' 218 | echo '[2].安装Homebrew(耗时可能有点长,请耐心等待,已经装过就不用装了)' 219 | echo '[n].退出' 220 | read DevInputNumber #Dev部分输入参数 221 | if [ "$DevInputNumber" == '1' ] 222 | then 223 | xcode-select --install 224 | echo '👌🏻理论上来讲你应该已经安装成功了,或者你已经安装过了(报error: command line tools are already installed错误).' 225 | echo '🤔如果报其他错(error),那多半是网络问题,请访问 https://developer.apple.com/download/all/ 登录您的Apple ID,然后手动下载.😁' 226 | elif [ "$DevInputNumber" == '2' ] 227 | then 228 | if which brew >/dev/null; then 229 | echo '✅你已经安装过了,无需重复安装!' 230 | else 231 | installBrew 232 | fi 233 | elif [ "$DevInputNumber" == 'n' ] 234 | then 235 | main 236 | else 237 | echo '❌输入错误!' 238 | fi 239 | } 240 | 241 | #===常用开发库安装函数结束=== 242 | 243 | 244 | #===高级系统功能函数=== 245 | 246 | function hyperOSFunction { 247 | echo '[1].查看硬盘读写数据(需安装支持软件)' 248 | echo '[2].查询SIP开关状态' 249 | echo '[n].退出' 250 | read hyperInputNumber #Hyper部分输入参数 251 | if [ "$hyperInputNumber" == '1' ] 252 | then 253 | if which smartctl >/dev/null; then 254 | echo "✅你已安装smartmontools,下面为你查询硬盘数据。😁" 255 | smartctl -a disk0 256 | else 257 | echo "❌看起来你没有安装smartmontools。为了更好地实现相关功能,我们首先需要安装smartmontools。在安装smartmontools之前,我们需要确认您已经安装了Homebrew。接下来我们会自动检测。" 258 | if which brew >/dev/null; then 259 | echo "✅您安装了Homebrew。我们将会通过brew安装smartmontools。😁" 260 | echo "👍smartmotools是macOS上的一个小工具,可以用来查询硬盘数据,不会弄坏您的电脑。你是否要安装smartmontools?(y/n)" 261 | read answer 262 | if [ $answer == "y" ] || [ $answer == "Y" ]; then 263 | brew install smartmontools 264 | echo "✅看起来您应该成功安装了smartmontools.🎉下面为你查询硬盘数据.😁" 265 | smartctl -a disk0 266 | else 267 | echo "❎您没有输入y,我们将不会为您安装smartmontools,您的电脑没有遭到修改,感谢您的使用.😁" 268 | fi 269 | else 270 | echo '❌您没有安装brew,是否安装Homebrew?(y/n)' 271 | read yOrNot 272 | if [ $yOrNot == "y" ] || [ $yOrNot == "Y" ]; then 273 | installBrew 274 | else 275 | echo "❎将不会安装Homebrew和smartmontools" 276 | fi 277 | fi 278 | fi 279 | elif [ "$hyperInputNumber" == '2' ] 280 | then 281 | status=$(csrutil status) 282 | if [[ $status == *"enabled"* ]]; then 283 | echo "✅您已打开SIP!" 284 | else 285 | echo "❌您已关闭SIP!" 286 | fi 287 | elif [ "$hyperInputNumber" == 'n' ] 288 | then 289 | main 290 | else 291 | echo '❌输入错误!' 292 | fi 293 | } 294 | 295 | function verifyTools { 296 | echo '[1].md5校验' 297 | echo '[2].sha256校验' 298 | echo '[3].sha512校验' 299 | echo '[4].sha1校验' 300 | echo '[5].crc32校验(需安装支持软件)' 301 | echo '[6].比对实用工具(区分大小写)' 302 | echo '[7].比对实用工具(不区分大小写)' 303 | echo '[n].退出' 304 | read verifyInputNumber #Verify部分输入参数 305 | if [ "$verifyInputNumber" == '1' ] 306 | then 307 | echo '请将要校验的文件拖到终端窗口' 308 | read md5Path 309 | md5 $md5Path 310 | echo '✅校验完成!' 311 | elif [ "$verifyInputNumber" == '2' ] 312 | then 313 | echo '请将要校验的文件拖到终端窗口' 314 | read sha256Path 315 | shasum -a 256 $sha256Path 316 | echo '✅检验完成!' 317 | elif [ "$verifyInputNumber" == '3' ] 318 | then 319 | echo '请将要校验的文件拖到终端窗口' 320 | read sha512Path 321 | shasum -a 512 $sha512Path 322 | echo '✅检验完成!' 323 | elif [ "$verifyInputNumber" == '4' ] 324 | then 325 | echo '请将要校验的文件拖到终端窗口' 326 | read sha1Path 327 | shasum -a 1 $sha1Path 328 | echo '✅检验完成!' 329 | elif [ "$verifyInputNumber" == '5' ] 330 | then 331 | if which cksfv >/dev/null; then 332 | echo "✅你已安装cksfv,下面请拖入要校验的文件到终端窗口.😁" 333 | read crc32Path 334 | cksfv $crc32Path 335 | echo '✅校验完成' 336 | else 337 | echo "❌看起来你没有安装cksfv。为了更好地实现相关功能,我们首先需要安装cksfv.在安装cksfv之前,我们需要确认您已经安装了Homebrew." 338 | if which brew >/dev/null; then 339 | echo "✅您安装了Homebrew.我们将会通过brew安装cksfv.😁" 340 | echo "👍cksfv是macOS上的一个小工具,可以用来校验crc32,不会弄坏您的电脑。你是否要安装cksfv?(y/n)" 341 | read answer 342 | if [ $answer == "y" ] || [ $answer == "Y" ]; then 343 | brew install cksfv 344 | echo "✅看起来您应该成功安装了cksfv🎉.下面请拖入要校验的文件到终端窗口.😁" 345 | read crc32Path1 346 | cksfv $crc32Path1 347 | else 348 | echo "❎您没有输入y,我们将不会为您安装cksfv,您的电脑没有遭到修改,感谢您的使用.😁" 349 | fi 350 | else 351 | echo '❌您没有安装brew,是否安装Homebrew?(y/n)' 352 | read yOrNot 353 | if [ $yOrNot == "y" ] || [ $yOrNot == "Y" ]; then 354 | installBrew 355 | else 356 | echo "❎将不会安装Homebrew和cksfv" 357 | fi 358 | fi 359 | fi 360 | elif [ "$verifyInputNumber" == '6' ] 361 | then 362 | echo '请输入第一个值' 363 | read key111 364 | echo '请输入第二个值' 365 | read key222 366 | if [ $key111 == $key222 ]; then 367 | echo '✅比对通过,两者一致!' 368 | else 369 | echo '❌比对不通过,两者不一致!' 370 | fi 371 | elif [ "$verifyInputNumber" == '7' ] 372 | then 373 | echo '请输入第一个值' 374 | read key111 375 | echo '请输入第二个值' 376 | read key222 377 | key111=$(echo $key111 | tr '[:upper:]' '[:lower:]') 378 | key222=$(echo $key222 | tr '[:upper:]' '[:lower:]') 379 | if [ $key111 == $key222 ]; then 380 | echo '✅比对通过,两者一致!' 381 | else 382 | echo '❌比对不通过,两者不一致!' 383 | fi 384 | elif [ "$verifyInputNumber" == 'n' ] 385 | then 386 | main 387 | else 388 | echo '❌输入错误!' 389 | fi 390 | } 391 | 392 | 393 | #===高级系统功能函数结束=== 394 | 395 | 396 | #===软件修复专区函数=== 397 | 398 | function fixTools { 399 | echo '[1].修复Sideloadly!的Local Anisette在macOS 13.1以上无法使用的问题' 400 | echo '[2].软件签名,修复破解软件无法使用的问题' 401 | echo '[n].退出' 402 | read fixInputNumber #fix部分输入参数 403 | if [ "$fixInputNumber" == '1' ] 404 | then 405 | if xcode-select -p &> /dev/null; then 406 | echo "✅你已经安装了Xcode CLT.接下来我们将为您修复.😁" 407 | for loop in 13.1 13.2 13.3 13.4 13.5 13.6 13.7 13.8 13.9 408 | do 409 | Arraykey="Supported${loop}PluginCompatibilityUUIDs" 410 | echo $Arraykey 411 | sudo /usr/libexec/PlistBuddy -c "Add :$Arraykey array" /Library/Mail/Bundles/SideloadlyPlugin.mailbundle/Contents/Info.plist 412 | sudo /usr/libexec/PlistBuddy -c "Add :$Arraykey: string 25288CEF-7D9B-49A8-BE6B-E41DA6277CF3" /Library/Mail/Bundles/SideloadlyPlugin.mailbundle/Contents/Info.plist 413 | sudo /usr/libexec/PlistBuddy -c "Add :$Arraykey: string 6FF8B077-81FA-45A4-BD57-17CDE79F13A5" /Library/Mail/Bundles/SideloadlyPlugin.mailbundle/Contents/Info.plist 414 | sudo /usr/libexec/PlistBuddy -c "Add :$Arraykey: string A4B49485-0377-4FAB-8D8E-E3B8018CFC21" /Library/Mail/Bundles/SideloadlyPlugin.mailbundle/Contents/Info.plist 415 | sudo /usr/libexec/PlistBuddy -c "Add :$Arraykey: string 890E3F5B-9490-4828-8F3F-B6561E513FCC" /Library/Mail/Bundles/SideloadlyPlugin.mailbundle/Contents/Info.plist 416 | done 417 | sudo codesign -f -s - /Library/Mail/Bundles/SideloadlyPlugin.mailbundle 418 | else 419 | echo "❌您没有安装Xcode CLT,是否安装Xcode CLT?(y/n)" 420 | read yOrNot 421 | isXcodeCLT 422 | fi 423 | elif [ "$fixInputNumber" == '2' ] 424 | then 425 | if xcode-select -p &> /dev/null; then 426 | echo "✅你已经安装了Xcode CLT.接下来我们将为您修复.😁" 427 | echo "请将你的app拖进来" 428 | read appPathInput 429 | sudo codesign -f -s - "${appPathInput}" && \ 430 | echo "✅你已成功软件签名.😁" 431 | else 432 | echo "❌您没有安装Xcode CLT,是否安装Xcode CLT?(y/n)" 433 | read yOrNot 434 | isXcodeCLT 435 | fi 436 | elif [ "$fixInputNumber" == 'n' ] 437 | then 438 | main 439 | else 440 | echo '❌输入错误!' 441 | fi 442 | } 443 | 444 | #===软件修复专区函数结束=== 445 | 446 | 447 | #===主函数=== 448 | 449 | function main { 450 | echo '请选择功能:' 451 | echo '[1].一般系统功能' 452 | echo '[2].开发库一键安装' 453 | echo '[3].进阶系统功能' 454 | echo '[4].校验专区' 455 | echo '[5].软件修复专区' 456 | echo '[6].测试专区' 457 | echo '[n].退出' 458 | read MainInputNumber 459 | if [ "$MainInputNumber" == '1' ] 460 | then 461 | OSFunction 462 | elif [ "$MainInputNumber" == '2' ] 463 | then 464 | devTools 465 | elif [ "$MainInputNumber" == '3' ] 466 | then 467 | hyperOSFunction 468 | elif [ "$MainInputNumber" == '4' ] 469 | then 470 | verifyTools 471 | elif [ "$MainInputNumber" == '5' ] 472 | then 473 | fixTools 474 | # elif [ "$MainInputNumber" == '6' ] 475 | # then 476 | # echo "开始测试" 477 | # testCLT 478 | elif [ "$MainInputNumber" == 'n' ] 479 | then 480 | echo '👍开源地址:https://github.com/Ligure-Studio/MacOSHelperShell' 481 | echo -e "${BLUE} 欢迎反馈问题或建议到 service@ligure.cn ,我们会持续跟进 ${NC}" 482 | sleep 1 483 | exit 0 484 | else 485 | echo '❌输入错误!' 486 | fi 487 | main 488 | } 489 | 490 | #===主函数=== 491 | 492 | 493 | 494 | #===执行主函数=== 495 | 496 | main 497 | 498 | #===执行主函数=== 499 | -------------------------------------------------------------------------------- /OSHelper_Stable.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | echo '====欢迎使用macOS Helper Shell====' 3 | echo '😁由明燊、小叶、Jerry共同开发和维护,基于MIT协议开源' 4 | echo '👍开源地址:https://github.com/Ligure-Studio/macOSHelperShell' 5 | echo '🤔如果遇到“Password”提示,请放心输入你电脑开机密码.脚本已经开源,不会上传数据.' 6 | echo "\033[31m 0.1.1-beta3(non-classified) \033[0m" 7 | echo '------------------------------' 8 | sleep 1 9 | function installBrew { 10 | echo '❓首先我们要检测你是否安装Xcode CLT.' 11 | if xcode-select -p &> /dev/null; then 12 | echo "✅你已经安装了Xcode CLT.接下来我们将为您安装Homebrew.😁" 13 | export HOMEBREW_BREW_GIT_REMOTE="https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git" 14 | export HOMEBREW_CORE_GIT_REMOTE="https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git" 15 | export HOMEBREW_BOTTLE_DOMAIN="https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles" 16 | echo '👍默认已进行换源' 17 | git clone --depth=1 https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/install.git brew-install 18 | /bin/bash brew-install/install.sh 19 | rm -rf brew-install 20 | export HOMEBREW_BREW_GIT_REMOTE="https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git" 21 | brew update 22 | export HOMEBREW_CORE_GIT_REMOTE="https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git" 23 | for tap in core cask{,-fonts,-drivers,-versions} command-not-found; do 24 | brew tap --custom-remote --force-auto-update "homebrew/${tap}" "https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-${tap}.git" 25 | done 26 | brew update 27 | test -r ~/.bash_profile && echo 'export HOMEBREW_BREW_GIT_REMOTE="https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git"' >> ~/.bash_profile # bash 28 | test -r ~/.bash_profile && echo 'export HOMEBREW_CORE_GIT_REMOTE="https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git"' >> ~/.bash_profile 29 | test -r ~/.profile && echo 'export HOMEBREW_BREW_GIT_REMOTE="https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git"' >> ~/.profile 30 | test -r ~/.profile && echo 'export HOMEBREW_CORE_GIT_REMOTE="https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git"' >> ~/.profile 31 | 32 | test -r ~/.zprofile && echo 'export HOMEBREW_BREW_GIT_REMOTE="https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git"' >> ~/.zprofile # zsh 33 | test -r ~/.zprofile && echo 'export HOMEBREW_CORE_GIT_REMOTE="https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git"' >> ~/.zprofile 34 | else 35 | echo "❌您没有安装Xcode CLT,是否安装Xcode CLT?(y/n)" 36 | read yOrNot 37 | if [ $yOrNot == "y" ] || [ $yOrNot == "Y" ]; then 38 | echo '⏩开始安装Xcode CLT' 39 | xcode-select --install 40 | echo '👌🏻理论上来讲你应该已经安装成功了,或者你已经安装过了(报error: command line tools are already installed错误).' 41 | echo '🤔如果报其他错(error),那多半是网络问题,请访问 https://developer.apple.com/download/all/ 登录您的Apple ID,然后手动下载.😁' 42 | echo '😀请再次输入6尝试安装Homebrew.' 43 | else 44 | echo '❎将不会安装Xcode CLT和Homebrew' 45 | fi 46 | fi 47 | } 48 | function main { 49 | echo '请选择功能:' 50 | echo '[1].开启"全部来源"' 51 | echo '[2].移除隔离属性(解决"已损坏问题")' 52 | echo '[3].将Dock重置为默认' 53 | echo '[4].开启/关闭通过刷指纹验证sudo' 54 | echo '[5].清除缩略图缓存(适用于缩略图被抢)' 55 | echo '[6].安装Xcode CLT(因国内网络问题,可能等待时间较长或安装失败)' 56 | echo '[7].安装Homebrew(耗时可能有点长,请耐心等待,已经装过就不用装了)' 57 | echo '[8].查看硬盘读写数据(需安装支持软件)' 58 | echo '[9].查询SIP开关状态' 59 | echo '[10].文件校验' 60 | echo '[11].修复Sideloadly!的Local Anisette在macOS 13.1以上无法使用的问题' 61 | echo '[n].退出' 62 | read inputNumber 63 | if [ "$inputNumber" == '1' ] 64 | then 65 | sudo spctl --master-disable 66 | echo '✅已完成' 67 | elif [ "$inputNumber" == '2' ] 68 | then 69 | echo '😀请输入软件路径(可将软件拖进终端)👉' 70 | read appPath 71 | sudo xattr -r -d com.apple.quarantine $appPath 72 | echo '✅已完成' 73 | elif [ "$inputNumber" == '3' ] 74 | then 75 | echo '⚠️ 你真的确认要操作吗?' 76 | echo '⚠️ 操作后Dock将重置为出厂设置且无法恢复!' 77 | echo '🤔是否仍然执行?(y/n)' 78 | read yOrNot 79 | if [ $yOrNot == "y" ] || [ $yOrNot == "Y" ]; then 80 | defaults delete com.apple.dock; killall Dock 81 | echo '✅已完成' 82 | else 83 | echo '❎将不会重置Dock' 84 | fi 85 | elif [ "$inputNumber" == '4' ] 86 | then 87 | echo '😀正在检测是否已经开启本功能……' 88 | status=$(sudo cat /etc/pam.d/sudo) 89 | if [[ $status == *"pam_tid.so"* ]]; then 90 | echo "🤔似乎已开启该功能, 是否需要关闭?(y/n)" 91 | read yOrNot 92 | if [ $yOrNot == "y" ] || [ $yOrNot == "Y" ]; then 93 | sed -i '' "/pam_tid.so/d" /etc/pam.d/sudo 94 | echo '✅已关闭' 95 | else 96 | echo '❎将不会关闭' 97 | fi 98 | else 99 | echo "👌没有开启该功能, 正在开启……" 100 | sudo sed '1i auth sufficient pam_tid.so' /etc/pam.d/sudo 101 | echo "✅已打开" 102 | fi 103 | elif [ "$inputNumber" == '5' ] 104 | then 105 | sudo find /private/var/folders/ \( -name com.apple.dock.iconcache -or -name com.apple.iconservices \) -exec rm -rfv {} \; 106 | sudo rm -rf /Library/Caches/com.apple.iconservices.store; 107 | killall Dock 108 | killall Finder 109 | echo '✅已完成' 110 | elif [ "$inputNumber" == '6' ] 111 | then 112 | xcode-select --install 113 | echo '👌🏻理论上来讲你应该已经安装成功了,或者你已经安装过了(报error: command line tools are already installed错误).' 114 | echo '🤔如果报其他错(error),那多半是网络问题,请访问 https://developer.apple.com/download/all/ 登录您的Apple ID,然后手动下载.😁' 115 | elif [ "$inputNumber" == '7' ] 116 | then 117 | if which brew >/dev/null; then 118 | echo '✅你已经安装过了,无需重复安装!' 119 | else 120 | installBrew 121 | fi 122 | elif [ "$inputNumber" == '8' ] 123 | then 124 | if which smartctl >/dev/null; then 125 | echo "✅你已安装smartmontools,下面为你查询硬盘数据。😁" 126 | smartctl -a disk0 127 | else 128 | echo "❌看起来你没有安装smartmontools。为了更好地实现相关功能,我们首先需要安装smartmontools。在安装smartmontools之前,我们需要确认您已经安装了Homebrew。接下来我们会自动检测。" 129 | if which brew >/dev/null; then 130 | echo "✅您安装了Homebrew。我们将会通过brew安装smartmontools。😁" 131 | echo "👍smartmotools是macOS上的一个小工具,可以用来查询硬盘数据,不会弄坏您的电脑。你是否要安装smartmontools?(y/n)" 132 | read answer 133 | if [ $answer == "y" ] || [ $answer == "Y" ]; then 134 | brew install smartmontools 135 | echo "✅看起来您应该成功安装了smartmontools.🎉下面为你查询硬盘数据.😁" 136 | smartctl -a disk0 137 | else 138 | echo "❎您没有输入y,我们将不会为您安装smartmontools,您的电脑没有遭到修改,感谢您的使用.😁" 139 | fi 140 | else 141 | echo '❌您没有安装brew,是否安装Homebrew?(y/n)' 142 | read yOrNot 143 | if [ $yOrNot == "y" ] || [ $yOrNot == "Y" ]; then 144 | installBrew 145 | else 146 | echo "❎将不会安装Homebrew和smartmontools" 147 | fi 148 | fi 149 | fi 150 | elif [ "$inputNumber" == '9' ] 151 | then 152 | status=$(csrutil status) 153 | if [[ $status == *"enabled"* ]]; then 154 | echo "✅您已打开SIP!" 155 | else 156 | echo "❌您已关闭SIP!" 157 | fi 158 | elif [ "$inputNumber" == '10' ] 159 | then 160 | echo '[1].md5校验' 161 | echo '[2].sha256校验' 162 | echo '[3].sha512校验' 163 | echo '[4].sha1校验' 164 | echo '[5].crc32校验(需安装支持软件)' 165 | echo '[6].比对实用工具(区分大小写)' 166 | echo '[7].比对实用工具(不区分大小写)' 167 | echo '[n].退出' 168 | read verifyInputNumber #Verify部分输入参数 169 | if [ "$verifyInputNumber" == '1' ] 170 | then 171 | echo '请将要校验的文件拖到终端窗口' 172 | read md5Path 173 | md5 $md5Path 174 | echo '✅校验完成!' 175 | elif [ "$verifyInputNumber" == '2' ] 176 | then 177 | echo '请将要校验的文件拖到终端窗口' 178 | read sha256Path 179 | shasum -a 256 $sha256Path 180 | echo '✅检验完成!' 181 | elif [ "$verifyInputNumber" == '3' ] 182 | then 183 | echo '请将要校验的文件拖到终端窗口' 184 | read sha512Path 185 | shasum -a 512 $sha512Path 186 | echo '✅检验完成!' 187 | elif [ "$verifyInputNumber" == '4' ] 188 | then 189 | echo '请将要校验的文件拖到终端窗口' 190 | read sha1Path 191 | shasum -a 1 $sha1Path 192 | echo '✅检验完成!' 193 | elif [ "$verifyInputNumber" == '5' ] 194 | then 195 | if which cksfv >/dev/null; then 196 | echo "✅你已安装cksfv,下面请拖入要校验的文件到终端窗口.😁" 197 | read crc32Path 198 | cksfv $crc32Path 199 | echo '✅校验完成' 200 | else 201 | echo "❌看起来你没有安装cksfv。为了更好地实现相关功能,我们首先需要安装cksfv.在安装cksfv之前,我们需要确认您已经安装了Homebrew." 202 | if which brew >/dev/null; then 203 | echo "✅您安装了Homebrew.我们将会通过brew安装cksfv.😁" 204 | echo "👍cksfv是macOS上的一个小工具,可以用来校验crc32,不会弄坏您的电脑。你是否要安装cksfv?(y/n)" 205 | read answer 206 | if [ $answer == "y" ] || [ $answer == "Y" ]; then 207 | brew install cksfv 208 | echo "✅看起来您应该成功安装了cksfv🎉.下面请拖入要校验的文件到终端窗口.😁" 209 | read crc32Path1 210 | cksfv $crc32Path1 211 | else 212 | echo "❎您没有输入y,我们将不会为您安装cksfv,您的电脑没有遭到修改,感谢您的使用.😁" 213 | fi 214 | else 215 | echo '❌您没有安装brew,是否安装Homebrew?(y/n)' 216 | read yOrNot 217 | if [ $yOrNot == "y" ] || [ $yOrNot == "Y" ]; then 218 | installBrew 219 | else 220 | echo "❎将不会安装Homebrew和cksfv" 221 | fi 222 | fi 223 | fi 224 | elif [ "$verifyInputNumber" == '6' ] 225 | then 226 | echo '请输入第一个值' 227 | read key111 228 | echo '请输入第二个值' 229 | read key222 230 | if [ $key111 == $key222 ]; then 231 | echo '✅比对通过,两者一致!' 232 | else 233 | echo '❌比对不通过,两者不一致!' 234 | fi 235 | elif [ "$verifyInputNumber" == '7' ] 236 | then 237 | echo '请输入第一个值' 238 | read key111 239 | echo '请输入第二个值' 240 | read key222 241 | key111=`echo $key111 | tr '[:upper:]' '[:lower:]'` 242 | key222=`echo $key222 | tr '[:upper:]' '[:lower:]'` 243 | if [ $key111 == $key222 ]; then 244 | echo '✅比对通过,两者一致!' 245 | else 246 | echo '❌比对不通过,两者不一致!' 247 | fi 248 | fi 249 | elif [ "$inputNumber" == '11' ] 250 | then 251 | if xcode-select -p &> /dev/null; then 252 | echo "✅你已经安装了Xcode CLT.接下来我们将为您修复.😁" 253 | for loop in 13.1 13.2 13.3 13.4 13.5 13.6 13.7 13.8 13.9 254 | do 255 | Arraykey="Supported${loop}PluginCompatibilityUUIDs" 256 | echo $Arraykey 257 | sudo /usr/libexec/PlistBuddy -c "Add :$Arraykey array" /Library/Mail/Bundles/SideloadlyPlugin.mailbundle/Contents/Info.plist 258 | sudo /usr/libexec/PlistBuddy -c "Add :$Arraykey: string 25288CEF-7D9B-49A8-BE6B-E41DA6277CF3" /Library/Mail/Bundles/SideloadlyPlugin.mailbundle/Contents/Info.plist 259 | sudo /usr/libexec/PlistBuddy -c "Add :$Arraykey: string 6FF8B077-81FA-45A4-BD57-17CDE79F13A5" /Library/Mail/Bundles/SideloadlyPlugin.mailbundle/Contents/Info.plist 260 | sudo /usr/libexec/PlistBuddy -c "Add :$Arraykey: string A4B49485-0377-4FAB-8D8E-E3B8018CFC21" /Library/Mail/Bundles/SideloadlyPlugin.mailbundle/Contents/Info.plist 261 | sudo /usr/libexec/PlistBuddy -c "Add :$Arraykey: string 890E3F5B-9490-4828-8F3F-B6561E513FCC" /Library/Mail/Bundles/SideloadlyPlugin.mailbundle/Contents/Info.plist 262 | done 263 | sudo codesign -f -s - /Library/Mail/Bundles/SideloadlyPlugin.mailbundle 264 | else 265 | echo "❌您没有安装Xcode CLT,是否安装Xcode CLT?(y/n)" 266 | read yOrNot 267 | if [ $yOrNot == "y" ] || [ $yOrNot == "Y" ]; then 268 | echo '⏩开始安装Xcode CLT' 269 | xcode-select --install 270 | echo '👌🏻理论上来讲你应该已经安装成功了,或者你已经安装过了(报error: command line tools are already installed错误).' 271 | echo '🤔如果报其他错(error),那多半是网络问题,请访问 https://developer.apple.com/download/all/ 登录您的Apple ID,然后手动下载.😁' 272 | echo '😀请再次尝试修复.' 273 | else 274 | echo '❎将不会安装Xcode CLT和修复' 275 | fi 276 | fi 277 | elif [ "$inputNumber" == 'n' ] 278 | then 279 | echo '👍开源地址:https://github.com/Ligure-Studio/macOSHelperShell' 280 | echo "\033[34m欢迎反馈问题或建议到 service@ligure.cn ,我们会持续跟进 \033[0m" 281 | sleep 1 282 | exit 0 283 | fi 284 | main 285 | } 286 | main 287 | 288 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |
3 |
4 |
3 |
4 |