【踩坑】最新亲测能用!修复MacOS安装软件时提示“应该移到废纸篓”并且无法打开软件

本文主要是介绍【踩坑】最新亲测能用!修复MacOS安装软件时提示“应该移到废纸篓”并且无法打开软件,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

转载请注明出处:小锋学长生活大爆炸[xfxuezhang.cn]

目录

网上方法的尝试

方法一:xattr

方法二:UPX

真的能用的方法

GateKeeper_Helper.command的内容


网上方法的尝试

方法一:xattr

以前的Mac版本可以通过以下方式来解开限制,可以先尝试一下:

sudo xattr -r -d com.apple.quarantine /Applications/Sketch.app

但新版本的Mac会报错没有权限:

方法二:UPX

也有方法说借助UPX来安装,具体来说:

brew install upx
sudo upx -d /Applications/Termius.app/Contents/MacOS/Termius

 但新版本的Mac依旧会报错:

真的能用的方法

1、首先下载这个脚本:macOS-GateKeeper-Helper: Simple macOS GateKeeper script.

2、授予可执行权限:

chmod +x GateKeeper_Helper.command

3、双击脚本运行,并选择“4”,按回车:

4、将要安装的app拖入(也可以直接输入路径),按回车:

5、安装成功,可以双击app运行了:

GateKeeper_Helper.command的内容

#!/bin/zsh#Attribute
GITHUB_URL="https://github.com/wynioux/macOS-GateKeeper-Helper"
RELEASE_VERSION="v1.2.2"
ROOT_PASSWORD=0# Color Set
# Reset
Color_Off='\033[0m'       # Text Reset# Regular Colors
Black='\033[0;30m'        # Black
Red='\033[0;31m'          # Red
Green='\033[0;32m'        # Green
Yellow='\033[0;33m'       # Yellow
Blue='\033[0;34m'         # Blue
Purple='\033[0;35m'       # Purple
Cyan='\033[0;36m'         # Cyan
White='\033[0;37m'        # White# Bold
BBlack='\033[1;30m'       # Black
BRed='\033[1;31m'         # Red
BGreen='\033[1;32m'       # Green
BYellow='\033[1;33m'      # Yellow
BBlue='\033[1;34m'        # Blue
BPurple='\033[1;35m'      # Purple
BCyan='\033[1;36m'        # Cyan
BWhite='\033[1;37m'       # White# Underline
UBlack='\033[4;30m'       # Black
URed='\033[4;31m'         # Red
UGreen='\033[4;32m'       # Green
UYellow='\033[4;33m'      # Yellow
UBlue='\033[4;34m'        # Blue
UPurple='\033[4;35m'      # Purple
UCyan='\033[4;36m'        # Cyan
UWhite='\033[4;37m'       # White# Functions
# Shows menu.
showMenu()
{echo "\n          GateKeeper Helper ${RELEASE_VERSION}"echo "          ${Blue}${GITHUB_URL}${Color_Off}\n"echo "${BGreen}Option 1: ${Green}Show GateKeeper Status${Color_Off}"echo "   ${BRed}Means:${Color_Off} Check GateKeeper status.\n"echo "${BGreen}Option 2: ${Green}Enable GateKeeper${Color_Off}"echo "   ${BRed}Means:${Color_Off} Enables GateKeeper."echo "       ${BCyan}>>${Color_Off} Best security.\n"echo "${BGreen}Option 3: ${Green}Disable GateKeeper${Color_Off}"echo "   ${BRed}Means:${Color_Off} Completely disables GateKeeper."echo "       ${BCyan}>>${Color_Off} Note that doing this introduces a major security risk in macOS.\n"echo "${BGreen}Option 4: ${Green}Remove app from GateKeeper quarantine${Color_Off}"echo "   ${BRed}Means:${Color_Off} Allows an individual quarantined app to run.\n"echo "${BGreen}Option 5: ${Green}Self-sign the app${Color_Off}"echo "   ${BRed}Means:${Color_Off} If GateKeeper is on and your app quits unexpectedly, try self-signing.\n"echo "${BGreen}Option 6: ${Green}Quit${Color_Off}"echo "   ${BRed}Means:${Color_Off} Quit script.\n"
}# Asks password.
askPassword()
{case $ROOT_PASSWORD in0)echo "${Cyan}Please provide your password to proceed, or press ^C to quit.${Color_Off}"ROOT_PASSWORD=1;;esac}# Shows continue message.
continueMessage()
{echo "\nPress any key to continue."read
}# Shows gatekeeper status.
showGateKeeperStatus()
{echo "${Green}You choose to show GateKeeper status.${Color_Off}"askPasswordsudo spctl --statuscontinueMessage
}# Enables gatekeeper.
enableGateKeeper()
{echo "${Green}You chose to enable GateKeeper. Good for you!${Color_Off}"askPasswordsudo spctl --master-enableecho "${Red}GateKeeper enabled.${Color_Off}"continueMessage
}# Disables gatekeeper.
disableGateKeeper()
{echo "${Green}You chose to disable GateKeeper.${Color_Off}"echo -e "    ${Red}>> Danger!${Color_Off}"echo -e "       Disabling GateKeeper is a very bad idea and creates"echo -e "       a major security hole in macOS\n"askPasswordsudo spctl --master-disableecho "${Red}GateKeeper disabled.${Color_Off}"continueMessage
}# Removes an app from gatekeeper quarantine
removeAppFromGateKeeper()
{echo "${Green}You chose to remove the app from GateKeeper quarantine.${Color_Off}"read "?Drag & drop the app on this window and then press Return: " FILEPATHaskPasswordsudo xattr -rd com.apple.quarantine "$FILEPATH"if [ $? -eq 0 ]; thenecho "${Red}App removed from quarantine.${Color_Off}"elseecho "${Red}App could not be removed from quarantine!${Color_Off}"ficontinueMessage
}# Self-signs an app.
selfSignApp()
{echo "${Green}You chose to self-sign an app.${Color_Off}"read "?Drag & drop the app on this window and then press Return: " FILEPATHaskPasswordsudo codesign -f -s - --deep "$FILEPATH"echo "${Red}If you see - replacing existing signature - that means you are done!${Color_Off}"echo "${Red}Otherwise please try again, sometimes it works second time.${Color_Off}"continueMessage
}# Shows quit message.
quitScript()
{echo "Quitting..."continueMessage
}# Shows invalid option message.
showInvalid()
{echo "${Red}Invalid option: ${BRed}${SELECTED_OPTION}${Color_Off}"continueMessage
}# Main function of the script.
startScript()
{while : doclearshowMenuread "?Please select an option: " SELECTED_OPTIONcase $SELECTED_OPTION in1)clearshowGateKeeperStatus;;2)clearenableGateKeeper;;3)cleardisableGateKeeper;;4)  clearremoveAppFromGateKeeper;;5)clearselfSignApp;;6)clearquitScriptbreak;;*)clearshowInvalid;;esacdone
}# Script starts here.
startScript

这篇关于【踩坑】最新亲测能用!修复MacOS安装软件时提示“应该移到废纸篓”并且无法打开软件的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/799703

相关文章

Springboot项目启动失败提示找不到dao类的解决

《Springboot项目启动失败提示找不到dao类的解决》SpringBoot启动失败,因ProductServiceImpl未正确注入ProductDao,原因:Dao未注册为Bean,解决:在启... 目录错误描述原因解决方法总结***************************APPLICA编

Python安装Pandas库的两种方法

《Python安装Pandas库的两种方法》本文介绍了三种安装PythonPandas库的方法,通过cmd命令行安装并解决版本冲突,手动下载whl文件安装,更换国内镜像源加速下载,最后建议用pipli... 目录方法一:cmd命令行执行pip install pandas方法二:找到pandas下载库,然后

解决pandas无法读取csv文件数据的问题

《解决pandas无法读取csv文件数据的问题》本文讲述作者用Pandas读取CSV文件时因参数设置不当导致数据错位,通过调整delimiter和on_bad_lines参数最终解决问题,并强调正确参... 目录一、前言二、问题复现1. 问题2. 通过 on_bad_lines=‘warn’ 跳过异常数据3

最新Spring Security的基于内存用户认证方式

《最新SpringSecurity的基于内存用户认证方式》本文讲解SpringSecurity内存认证配置,适用于开发、测试等场景,通过代码创建用户及权限管理,支持密码加密,虽简单但不持久化,生产环... 目录1. 前言2. 因何选择内存认证?3. 基础配置实战❶ 创建Spring Security配置文件

Linux系统中查询JDK安装目录的几种常用方法

《Linux系统中查询JDK安装目录的几种常用方法》:本文主要介绍Linux系统中查询JDK安装目录的几种常用方法,方法分别是通过update-alternatives、Java命令、环境变量及目... 目录方法 1:通过update-alternatives查询(推荐)方法 2:检查所有已安装的 JDK方

SQL Server安装时候没有中文选项的解决方法

《SQLServer安装时候没有中文选项的解决方法》用户安装SQLServer时界面全英文,无中文选项,通过修改安装设置中的国家或地区为中文中国,重启安装程序后界面恢复中文,解决了问题,对SQLSe... 你是不是在安装SQL Server时候发现安装界面和别人不同,并且无论如何都没有中文选项?这个问题也

2025版mysql8.0.41 winx64 手动安装详细教程

《2025版mysql8.0.41winx64手动安装详细教程》本文指导Windows系统下MySQL安装配置,包含解压、设置环境变量、my.ini配置、初始化密码获取、服务安装与手动启动等步骤,... 目录一、下载安装包二、配置环境变量三、安装配置四、启动 mysql 服务,修改密码一、下载安装包安装地

Redis MCP 安装与配置指南

《RedisMCP安装与配置指南》本文将详细介绍如何安装和配置RedisMCP,包括快速启动、源码安装、Docker安装、以及相关的配置参数和环境变量设置,感兴趣的朋友一起看看吧... 目录一、Redis MCP 简介二、安www.chinasem.cn装 Redis MCP 服务2.1 快速启动(推荐)2.

在macOS上安装jenv管理JDK版本的详细步骤

《在macOS上安装jenv管理JDK版本的详细步骤》jEnv是一个命令行工具,正如它的官网所宣称的那样,它是来让你忘记怎么配置JAVA_HOME环境变量的神队友,:本文主要介绍在macOS上安装... 目录前言安装 jenv添加 JDK 版本到 jenv切换 JDK 版本总结前言China编程在开发 Java

电脑提示d3dx11_43.dll缺失怎么办? DLL文件丢失的多种修复教程

《电脑提示d3dx11_43.dll缺失怎么办?DLL文件丢失的多种修复教程》在使用电脑玩游戏或运行某些图形处理软件时,有时会遇到系统提示“d3dx11_43.dll缺失”的错误,下面我们就来分享超... 在计算机使用过程中,我们可能会遇到一些错误提示,其中之一就是缺失某个dll文件。其中,d3dx11_4