【踩坑】最新亲测能用!修复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

相关文章

如何解决mmcv无法安装或安装之后报错问题

《如何解决mmcv无法安装或安装之后报错问题》:本文主要介绍如何解决mmcv无法安装或安装之后报错问题,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录mmcv无法安装或安装之后报错问题1.当我们运行YOwww.chinasem.cnLO时遇到2.找到下图所示这里3.

Python 安装和配置flask, flask_cors的图文教程

《Python安装和配置flask,flask_cors的图文教程》:本文主要介绍Python安装和配置flask,flask_cors的图文教程,本文通过图文并茂的形式给大家介绍的非常详细,... 目录一.python安装:二,配置环境变量,三:检查Python安装和环境变量,四:安装flask和flas

Win11安装PostgreSQL数据库的两种方式详细步骤

《Win11安装PostgreSQL数据库的两种方式详细步骤》PostgreSQL是备受业界青睐的关系型数据库,尤其是在地理空间和移动领域,:本文主要介绍Win11安装PostgreSQL数据库的... 目录一、exe文件安装 (推荐)下载安装包1. 选择操作系统2. 跳转到EDB(PostgreSQL 的

Linux系统中卸载与安装JDK的详细教程

《Linux系统中卸载与安装JDK的详细教程》本文详细介绍了如何在Linux系统中通过Xshell和Xftp工具连接与传输文件,然后进行JDK的安装与卸载,安装步骤包括连接Linux、传输JDK安装包... 目录1、卸载1.1 linux删除自带的JDK1.2 Linux上卸载自己安装的JDK2、安装2.1

macOS无效Launchpad图标轻松删除的4 种实用方法

《macOS无效Launchpad图标轻松删除的4种实用方法》mac中不在appstore上下载的应用经常在删除后它的图标还残留在launchpad中,并且长按图标也不会出现删除符号,下面解决这个问... 在 MACOS 上,Launchpad(也就是「启动台」)是一个便捷的 App 启动工具。但有时候,应

Linux卸载自带jdk并安装新jdk版本的图文教程

《Linux卸载自带jdk并安装新jdk版本的图文教程》在Linux系统中,有时需要卸载预装的OpenJDK并安装特定版本的JDK,例如JDK1.8,所以本文给大家详细介绍了Linux卸载自带jdk并... 目录Ⅰ、卸载自带jdkⅡ、安装新版jdkⅠ、卸载自带jdk1、输入命令查看旧jdkrpm -qa

MySQL Workbench 安装教程(保姆级)

《MySQLWorkbench安装教程(保姆级)》MySQLWorkbench是一款强大的数据库设计和管理工具,本文主要介绍了MySQLWorkbench安装教程,文中通过图文介绍的非常详细,对大... 目录前言:详细步骤:一、检查安装的数据库版本二、在官网下载对应的mysql Workbench版本,要是

Linux安装MySQL的教程

《Linux安装MySQL的教程》:本文主要介绍Linux安装MySQL的教程,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录linux安装mysql1.Mysql官网2.我的存放路径3.解压mysql文件到当前目录4.重命名一下5.创建mysql用户组和用户并修

mss32.dll文件丢失怎么办? 电脑提示mss32.dll丢失的多种修复方法

《mss32.dll文件丢失怎么办?电脑提示mss32.dll丢失的多种修复方法》最近,很多电脑用户可能遇到了mss32.dll文件丢失的问题,导致一些应用程序无法正常启动,那么,如何修复这个问题呢... 在电脑常年累月的使用过程中,偶尔会遇到一些问题令人头疼。像是某个程序尝试运行时,系统突然弹出一个错误提

电脑提示找不到openal32.dll文件怎么办? openal32.dll丢失完美修复方法

《电脑提示找不到openal32.dll文件怎么办?openal32.dll丢失完美修复方法》openal32.dll是一种重要的系统文件,当它丢失时,会给我们的电脑带来很大的困扰,很多人都曾经遇到... 在使用电脑过程中,我们常常会遇到一些.dll文件丢失的问题,而openal32.dll的丢失是其中比较