61

I just configure a project in bitrise.io. But the xcode-build fails with error:

xcodebuild: error: The project named "Foo" does not contain a scheme named "Bar". The "-list" option can be used to find the names of the schemes in the project.

I double check and the scheme Bar does exist in the project Foo

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
Guilherme Torres Castro
  • 15,135
  • 7
  • 59
  • 96
  • how to locate the schema from this message. I am getting exactly this message.[ xcodebuild: error: The workspace named "jamesAppV2" does not contain a scheme named "". The "-list" option can be used to find the names of the schemes in the workspace.] – Qadir Hussain Mar 11 '16 at 12:47

10 Answers10

64

Based on the Bryan Mussial answer

The root cause is that the default behavior of Schemes is to keep schemes 'private' until they are specifically marked as shared. In the case of a command-line initiated build, the Xcode UI never runs and the xcoderun tool doesn't have its own cache of Schemes to work with.

To your schema be visible for command-line build you must mark it as a shared scheme.

  1. From the menu bar, select Product > Scheme > Manage Schemes
  2. Ensure the 'Shared' box is checked for that scheme
  3. A new .xcscheme file has been created in your project at
    WorkspaceName.xcworkspace/xcshareddata/xcschemes.
  4. Commit this file to your repository
Brandon Minnick
  • 13,342
  • 15
  • 65
  • 123
Guilherme Torres Castro
  • 15,135
  • 7
  • 59
  • 96
  • @M.Y.The first line of my answer already has a link for the source. In fact the text from his answer is highlighted, to explicitly that is quoted. – Guilherme Torres Castro Dec 04 '15 at 16:49
  • 1
    how to locate the schema from this message. I am getting exactly this message.[ xcodebuild: error: The workspace named "jamesAppV2" does not contain a scheme named "". The "-list" option can be used to find the names of the schemes in the workspace.] – Qadir Hussain Mar 11 '16 at 12:48
  • 30
    I am getting the same error , even after following all the steps :( – Trupti Jul 05 '16 at 16:46
  • @QadirHussain did you find any solution on your problem? I am getting same issue .. – Khushabu Nov 06 '19 at 09:48
  • react native peeps follow this one: https://stackoverflow.com/a/57286808/6363952 – Charitha Goonewardena Aug 03 '21 at 13:54
34

If you don't use cocoapods in your project you should remove .xcworkspace file from ./ios directory.

AnthoPak
  • 4,191
  • 3
  • 23
  • 41
yqbk
  • 706
  • 2
  • 7
  • 15
  • 4
    Yes! That worked! I had all the settings correct, but it just wouldn't work before. – Waltari Apr 18 '18 at 12:19
  • 2
    The selected answer didn't work for this issue occurred with using react native cli, but this one (removing `.xcworkspace` file) worked like a charm! – Pandemonium May 13 '18 at 17:29
  • 2
    Thanks! I use ReactNative, was playing around with additional deps that required cocoapods, but afterwards decided to revert and don't use them. And seems like `.xcworkspace` was created and didn't show up as changes in git. – SublimeYe Aug 10 '18 at 23:54
18

If this is happened after a project rename this is manually fixable

  1. Open Foo as a directory in finder.
  2. Open the folder xcshareddata/xcschemes
  3. Rename the xcscheme files there
Haseeb A
  • 5,356
  • 1
  • 30
  • 34
7

You can follow the instruction as in the image below.

enter image description here

Alish Giri
  • 1,855
  • 18
  • 21
4

Solution 1::

On XCode:

1 - Go to Product/Scheme/Manager Schemes...
2 - Select the Scheme you want to create and click on the "Edit" button.
3 - Uncheck and check again the "Shared" checkbox.

Solution 2:

On Finder:

1 - Go to YOUR_PROJECT.xcodeproj/xcshareddata.
2 - Copy the xcschemes folder.
3 - Go to YOUR_PROJECT.xcworkspace/xcshareddata.
4 - Paste the xcschemes folder

CarlFerr
  • 51
  • 1
  • 4
3

Open your Xcode and follow the steps

  1. Open your project.xcworkspace file in xcode or open ios folder in Xcode if you are using react native.
  2. Go to Product > Schemes > Manage Schemes
  3. In the list select your project
  4. Select Edit > duplicate scheme and rename with the name of your project you just changed or what is it.
  5. Close the window, again go to Product > Schemes > Manage Schemes
  6. This time select the project and select - option near to the edit button

it will remove your old workspace file and you'll have the new file only.

1

I was getting this error when I changed project name in xcode

it created new [new_name].xcworkspace

if your ios folder has [old_name].xcworkspace

then delete: [old_name].xcworkspace

and run again!

Akshay Pagare
  • 176
  • 2
  • 9
0

Make sure you have CocoaPods installed.

In Terminal, switch (cd) to your project's directory. Once there, run pod install and the program will download the required files.

Bryan Scott
  • 4,627
  • 1
  • 10
  • 12
Chinedu Ofor
  • 707
  • 9
  • 11
0

I got the same issue after returning my mac to factory settings and essentially updating it to Big Sur.

You should definitely first check if your schemes are checked as "Shared". Then, in xcode -> preferences -> locations, see if your current version of xcode is selected in the field "Command Line Tools".

Also, make sure that you have a scheme with the exact name that the error is saying ("bar", not "bar.dev"). That scheme can be empty (no actions or anything). Your schemes should also be in the yourappname Workspace (that's when you open "Manage schemes").

Finally what actually fixed it for me was this:

  1. cd ios
  2. pod deintegrate
  3. pod install
  4. cd ..
  5. run your app
0

Expo only: after manually changing the name, I had to regenerate the project using expo run:ios.

Daniel Danielecki
  • 8,508
  • 6
  • 68
  • 94