“Xcode” is damaged and can’t be opened. You should

2019-02-17 06:22发布

问题:

Installed XCode 6 on Mavericks. It din't run. Updated OS to Yosemite 10.10 : Now Xcode.app (installed through *.dmg) launch fails with error message “Xcode” is damaged and can’t be opened. You should move it to the Trash. Updated to XCode 6.0.1 through App Store. Still no luck. Same error message. Anyone with a fix?

回答1:

I experienced this error with any new added application under (all) macOS Sierra builds.

The only solution that worked for me was to execute :

xattr -rc /Applications/<faulty application>.app

You can also use the following command to "repair" all applications :

xattr -rc /Applications/*.app


回答2:

Some times in below options

  • Open System Preferences
  • Click on "Security & Privacy"

Allow apps downloaded from contains only 2 options "AnyWhere" is missing for that open your terminal and add below line

sudo spctl --master-disable

enter your system password. Now you quit System Preferences and reopen it System Preferences/Security & Privacy/General now "AnyWhere" option will be there. Hurrah You have done it.

hope it will work for you.



回答3:

I know this is an older question, but if you're like me and absolutely want to install Xcode from a DMG and not from the App Store, there is a way, inspired by this post from Will Lowe that talks about installing an un-signed application.

  1. Install the DMG as usual (Double-click, Drag-n-drop)
  2. Open System Preferences
  3. Click on "Security & Privacy"
  4. Adjust the "Allow applications downloaded from:" setting to "Anywhere"
  5. Open Xcode
  6. Be patient while it verifies and opens

You only need to do this the first time you open Xcode, so you can change your Security settings back to their original value after Xcode has fully launched.



回答4:

If you trust the people from whom you are downloading things you can bypass the warning by adjusting your ‘Preferences > Security & Privacy’ to

Allow applications downloaded from: Anywhere



回答5:

I have just experienced this with Xcode 6.1.1 on Yosemite, except it only happened when I build and run in the simulator - on app launch Xcode would crash and a panel would declare "Xcode is damaged. Delete it and download again from the App Store".

I did all of the following to solve it:

  • Delete derived project data and full clean
  • Delete app from simulator and quit simulator
  • Reboot

Anyway just in case this helps a new visitor to this question :)