51

I have downloaded one project from the internet and, when I am trying to run it/build it the XCode, XCode says :

The file “PROJECT NAME” couldn’t be opened because you don’t have permission to view it.

I have also put read/write permission to the project folder as well but still not working.

Why does this is happen? Please help me to resolve this issue

jogshardik
  • 1,446
  • 1
  • 12
  • 23
  • 2
    try to change the project name and run again – Dharmesh Kheni Dec 08 '14 at 10:01
  • @DharmeshKheni yup already done it but still same issue. – jogshardik Dec 08 '14 at 10:13
  • 1
    Possible duplicate of ["The file "MyApp.app" couldn't be opened because you don't have permission to view it" when running app in Xcode 6 Beta 4](https://stackoverflow.com/questions/24924809/the-file-myapp-app-couldnt-be-opened-because-you-dont-have-permission-to-vi) – Senseful Apr 24 '18 at 04:29
  • Refer to this [answer](https://stackoverflow.com/a/50167291/6521116) with a good summary of this issue. – LF00 May 04 '18 at 05:20

26 Answers26

61

Go up to the folder containing the project in your Finder.

Right Click > Get Info

Go to the bottom of the Info pane, and click the little lock, type in your password when prompted.

Then, change permissions for yourself to read+write.

Click the little gear below, and apply to all enclosed items.

Close the lock once you are finished!

If this doesn't work, Change the value of "Compiler for C/C++/Objective-C" to "Default Compiler (Apple Clang)" under the Build Settings of your target.

Oleh Veheria
  • 412
  • 5
  • 13
Michael Voznesensky
  • 1,612
  • 12
  • 15
27

The project i have download from the internet don't have the Executable file in info.plist which should be there and its value should be this ${EXECUTABLE_NAME}. Instead of this value it consist some different value. So i have changed it ${EXECUTABLE_NAME} this value then clean->build->run successfully.

jogshardik
  • 1,446
  • 1
  • 12
  • 23
  • 1
    Thanks for this one, it helped me after I duplicated a project. My executable file name was still the old app name. – JohnnyC Oct 14 '15 at 22:41
  • I had changed the info.plist file the earlier file didn't have the ${EXECUTABLE_NAME} set! Thanks a lot this worked for me – Mudit Jaju Aug 31 '16 at 17:52
  • 2
    This worked. Hey, Apple, would it be so hard to use an "if" statement to make the error say "I can't run your program because the name of your target doesn't match the name in your info.plist?" – M Katz Nov 05 '16 at 03:09
  • Perfect! Working for me. – Govaadiyo Jul 28 '17 at 12:01
  • Thanks a lot, this worked. I would add that the build system creates executable file named .app, and if you change in Info.plist, the system just won't find the executable. Can't believe Apple still didn't fixed it. – Borzh Nov 17 '18 at 01:26
20

None of the answers helped me. Although the build was successful i got the error while trying to run the project. Accidentally while cloning the project, there were no files under the Build Phases -> Compile Sources.This might have happened while working on a team in git.

Files under compile sources may be the entry point to be able to build/run the project.

enter image description here

Once i added the AppDelegate & ViewController file in compile sources i was able to run the project without any error.

enter image description here

LC 웃
  • 18,888
  • 9
  • 57
  • 72
  • Thank you, this helped me. How can we ensure these compile sources and copy bundle resources references are saved to the remote repository so when we clone the project it works normally? – Roman Samoilenko Feb 05 '18 at 11:41
15

Take your Projects build Setting

In Architecture section make sure that Architectures and Valid Architectures are the same. If any extra Architecture is present in Valid Architecture section please remove it and then try building the code, It will work. enter image description here Here in the image edit the section marked as red.

Sudhin Davis
  • 2,010
  • 13
  • 18
11

I had similar issue ad problem was there was an info.plist file in one of the folder in framework that i downloaded from GitHub , deleting it fixed the issue

vishal dharankar
  • 7,536
  • 7
  • 57
  • 93
9

I had the same problem. In my case, it caused from I try change display name's app from default to another by edit "Executable file" in Info.plit then compile, it will show this error. So I edit value property "Executable file" as default then edit value property "Bundle name" instead.

enter image description here

Kakashi
  • 534
  • 11
  • 16
  • Thanks for this one, it helped me after I duplicated a project. My executable file name was still the old app name. – JohnnyC Oct 14 '15 at 22:41
7

I had the same error message wit ha project with Xcode 6.1.1.

What I did to resolve it was the following:

  • in Build settings, "Architectures" section: set "Architectures" (ARCHS) to "Standard architectures (armv7, arm64)" for your target and/or project as needed.
  • in Build settings, "Build Options" section: set GCC_VERSION to "Default Compiler (Apple LLVM 6.0)" for project

I was able to launch and test the project with theses settings.

Nicolas Buquet
  • 3,880
  • 28
  • 28
7

Clean the project inside Xcode.

Go to Product -> Clean

That worked for me.

Manuel BM
  • 868
  • 1
  • 13
  • 17
5

Select TARGETS -> General -> Identity -> Version (should be 1.0 or whatever version you want).

Dorald
  • 724
  • 7
  • 12
5

Doing a Product -> Clean and deleting derived data then rebuilt project worked for me.

The story is that I had 2 projects opened at same time. I've deployed first project on my device and after a while I was trying to deploy second one (initially stopped running first application), then got this ugly error message.

nsinvocation
  • 7,559
  • 3
  • 41
  • 46
4

Just figured out it can be another problem. It can happen that your Main.m file isn't included anymore in the Build Phases -> compile sources. You'll get the same error. You can just re-add it by clicking the plus and selecting the file from the dialog.

Nys
  • 96
  • 3
2

Check if Xcode version that you are using is up to date to open the source code. Also check if you have third party libraries, included in it. Check if deployment target, build target etc are up to date in the project settings.

NewStackUser
  • 657
  • 5
  • 17
2

Some how my project's Info.plist was missing See Below:

Before:

enter image description here

After:

enter image description here

I have drag and drop the info.plist file path and it worked for me.. :)

Dheeraj D
  • 4,386
  • 4
  • 20
  • 34
2

I have same issue. The problem is with project target membership was removed when I dragged and drop files externally. enter image description here

I added Target membership for it and its working fine for me.

enter image description here

mrunal thanki
  • 753
  • 6
  • 16
1

I've had same this error in Xcode 8.2. The reason I found out for me, I've included Info.plist from outside project folder (manually copy).

So that Xcode is getting confused for select correct Info.plist.

I just removed that Info.plist from the added library.

Then it is working fine without any permission alert.

Antony Raphel
  • 2,036
  • 2
  • 25
  • 45
1

I deleted a folder that had some header files and plist files from a project I dragged and dropped from. This solved the problem for me. I hope it helps you.

enter image description here

uplearned.com
  • 3,393
  • 5
  • 44
  • 59
1

I got same problem, when running objective c project in Xcode 12.4 & macOS Big Sur. My screen shot as below. The file "" couldn't be opened because you don't have permission

solution as below:

  1. Add "VALID_ARCHS" value "arm64 arm64e armv7 armv7s x86_64" screen shot as below

enter image description here

  1. Change "Build System" to "New Build System" using below steps:
  • Open xcode project
  • Open File -> Project Settings -> Per-User Project Settings: -> Build System: -> "New Build System" -> Done
  1. Add "Excluded Architectures" as "arm64" enter image description here
Arshad Shaik
  • 1,095
  • 12
  • 18
0

I had similar issues with Xcode 7.3:

The file “FirstSteps.temp_caseinsensitive_rename” couldn’t be opened because you don’t have permission to view it.

In my case the solution was to change the Product Name in the Packaging section of the Build Settings:

from "FirstSteps.temp_caseinsensitive_rename" to "FirstSteps"

screenshot

apphipster
  • 16
  • 1
0

I had the same issue but a different cause; answering here for anyone who gets stuck like me in the future.

In my case the issue was that my Xcode project contained no source code directly. All the code, including main(), was being pulled in from an externally-built static library. The solution was to add an empty dummy.cpp file to the project.

Karu
  • 4,512
  • 4
  • 30
  • 31
0

In my case, the cause for this error was different. I had, for some reason removed my AppDelegate's Target Membership from the Application Target. I din't realise that it caused the issue for a long time coz it did work briefly even after I had removed the Target Membership, but later stopped working.

So, make sure you have your AppDelegate set for your Application Target.

@UIApplicationMain // <- THIS
class AppDelegate: UIResponder, UIApplicationDelegate {

}
Casper
  • 152
  • 12
0

In my case : xcode menu - product- clean and then build fix the problem.

I imported framework project into another project for some reason I got this error also.

user1105951
  • 2,259
  • 2
  • 34
  • 55
0

I just Cleaned the project and it worked perfectly.

go to "product" and press "clean"

M.E
  • 11
  • 1
0

Ok, so if any other person facing the same issue on XCode 10, I have fixed it by goin to File->Workspace settings->Build System I made it Legacy build system and it worked!

Mostafa
  • 1,522
  • 2
  • 18
  • 34
0

LC 웃 is right on my case. Have deleted the Build Phases -> Copy Bundle Resources build phase which leads this issue. And, adding it back fixed this issue. Also make sure files are present in the build phase.

Praveenkumar
  • 24,084
  • 23
  • 95
  • 173
0

In my case I have Xcode 10.1 & 11 installed to my machine. Not sure whether this will create a problem like this.

I tried all this tips. But didn't solve my issue. Then I tried, manually deleted all files which throws this error and then added it again manually.

Which worked perfectly for me.

arango_86
  • 4,236
  • 4
  • 40
  • 46
-1

I had the similar issue upon updating my macOS and Xcode (Xcode Version 11.2.1 & Swift 5 ), tried most of the solutions above, but did not seem to work.

However i deleted Xcode and reinstalled it - seems to have resolve the issue.