Why is “xcodebuild: command not found” in this build script?












0














Hi I have the following in the root of my xcode project:



#!/bin/bash
xcodebuild -scheme target1 clean;
xcodebuild -scheme target1 archive;
xcodebuild -scheme target2 clean;
xcodebuild -scheme target2 archive;


However, this only executes the first line xcodebuild -scheme target1 clean; and then yields



...
** CLEAN SUCCEEDED **

xcodebuild: command not found
xcodebuild: command not found
xcodebuild: command not found


Disclaimer: I'm an absolute Mac OS X / Unix greenhorn.



Edit: Following kranteg's suggestion I added pwd to the script:



#!/bin/bash
pwd;
xcodebuild -scheme target1 clean;
pwd;
xcodebuild -scheme target1 archive;
pwd;
xcodebuild -scheme target2 clean;
pwd;
xcodebuild -scheme target2 archive;
pwd;


The output:



/Users/CKU/Programme/uraClient
=== CLEAN TARGET uraClient OF PROJECT uraClient WITH CONFIGURATION Debug ===

Check dependencies

<... lots of compiler messages about the clean ...>

** CLEAN SUCCEEDED **

/Users/CKU/Programme/uraClient
xcodebuild: command not found
/Users/CKU/Programme/uraClient
xcodebuild: command not found
/Users/CKU/Programme/uraClient
xcodebuild: command not found
/Users/CKU/Programme/uraClient


Edit 2: Replacing the pwd with echo $PATH yields a better result, now the script performs the first three xcodebuild commands before failing. However, the PATH variable seems to be unaffected by xcodebuild:



/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:Desktop/adt-bundle-mac-x86_64-20130522/sdk/platform-tools
=== CLEAN TARGET uraClient OF PROJECT uraClient WITH CONFIGURATION Debug ===

<... log messages ...>

** CLEAN SUCCEEDED **

/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:Desktop/adt-bundle-mac-x86_64-20130522/sdk/platform-tools
=== BUILD TARGET uraClient OF PROJECT uraClient WITH CONFIGURATION Release ===

<... log messages ...>

** ARCHIVE SUCCEEDED **


The following commands produced analyzer issues:
AnalyzeShallow uraClient/SQLiteLibrary/SQLiteManager.m
AnalyzeShallow uraClient/URA/NSString+UrlEncoding.m
AnalyzeShallow uraClient/Services/UraTripPredictionsProvider.m
AnalyzeShallow uraClient/UtilityAppViewController/ViewController.m
AnalyzeShallow uraClient/RNCryptor/RNDecryptor.m
AnalyzeShallow uraClient/RNCryptor/RNEncryptor.m
AnalyzeShallow uraClient/RNCryptor/RNOpenSSLCryptor.m
AnalyzeShallow uraClient/RNCryptor/RNOpenSSLDecryptor.m
AnalyzeShallow uraClient/RNCryptor/RNOpenSSLEncryptor.m
(9 commands with analyzer issues)
/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:Desktop/adt-bundle-mac-x86_64-20130522/sdk/platform-tools
=== CLEAN TARGET uraAseag OF PROJECT uraClient WITH CONFIGURATION Debug ===

<... log messages ..>

** CLEAN SUCCEEDED **

/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:Desktop/adt-bundle-mac-x86_64-20130522/sdk/platform-tools
xcodebuild: command not found
/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:Desktop/adt-bundle-mac-x86_64-20130522/sdk/platform-tools









share|improve this question




















  • 1




    Can you launch pwd before and after you run this script ? xcodebuild seems to change the working directory.
    – kranteg
    Jun 27 '14 at 7:52






  • 1




    Perhaps xcodebuild makes change to your PATH variable. Can you add echo $PATH to your script instead of pwd ?
    – kranteg
    Jun 30 '14 at 8:42






  • 1




    It should work if you use absolute path, so use /usr/bin/xcodebuild in your script. But I don't understand why it's not working.
    – kranteg
    Jun 30 '14 at 13:24






  • 1




    You can pass multiple actions to single invocation: clean archive. What is the purpose of ; at the end of the command?
    – Opal
    Jun 30 '14 at 16:47








  • 1




    @kranteg & Opal: I've found a working solution by combining your suggestions. Many Thanks!
    – Chris
    Jul 2 '14 at 7:39
















0














Hi I have the following in the root of my xcode project:



#!/bin/bash
xcodebuild -scheme target1 clean;
xcodebuild -scheme target1 archive;
xcodebuild -scheme target2 clean;
xcodebuild -scheme target2 archive;


However, this only executes the first line xcodebuild -scheme target1 clean; and then yields



...
** CLEAN SUCCEEDED **

xcodebuild: command not found
xcodebuild: command not found
xcodebuild: command not found


Disclaimer: I'm an absolute Mac OS X / Unix greenhorn.



Edit: Following kranteg's suggestion I added pwd to the script:



#!/bin/bash
pwd;
xcodebuild -scheme target1 clean;
pwd;
xcodebuild -scheme target1 archive;
pwd;
xcodebuild -scheme target2 clean;
pwd;
xcodebuild -scheme target2 archive;
pwd;


The output:



/Users/CKU/Programme/uraClient
=== CLEAN TARGET uraClient OF PROJECT uraClient WITH CONFIGURATION Debug ===

Check dependencies

<... lots of compiler messages about the clean ...>

** CLEAN SUCCEEDED **

/Users/CKU/Programme/uraClient
xcodebuild: command not found
/Users/CKU/Programme/uraClient
xcodebuild: command not found
/Users/CKU/Programme/uraClient
xcodebuild: command not found
/Users/CKU/Programme/uraClient


Edit 2: Replacing the pwd with echo $PATH yields a better result, now the script performs the first three xcodebuild commands before failing. However, the PATH variable seems to be unaffected by xcodebuild:



/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:Desktop/adt-bundle-mac-x86_64-20130522/sdk/platform-tools
=== CLEAN TARGET uraClient OF PROJECT uraClient WITH CONFIGURATION Debug ===

<... log messages ...>

** CLEAN SUCCEEDED **

/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:Desktop/adt-bundle-mac-x86_64-20130522/sdk/platform-tools
=== BUILD TARGET uraClient OF PROJECT uraClient WITH CONFIGURATION Release ===

<... log messages ...>

** ARCHIVE SUCCEEDED **


The following commands produced analyzer issues:
AnalyzeShallow uraClient/SQLiteLibrary/SQLiteManager.m
AnalyzeShallow uraClient/URA/NSString+UrlEncoding.m
AnalyzeShallow uraClient/Services/UraTripPredictionsProvider.m
AnalyzeShallow uraClient/UtilityAppViewController/ViewController.m
AnalyzeShallow uraClient/RNCryptor/RNDecryptor.m
AnalyzeShallow uraClient/RNCryptor/RNEncryptor.m
AnalyzeShallow uraClient/RNCryptor/RNOpenSSLCryptor.m
AnalyzeShallow uraClient/RNCryptor/RNOpenSSLDecryptor.m
AnalyzeShallow uraClient/RNCryptor/RNOpenSSLEncryptor.m
(9 commands with analyzer issues)
/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:Desktop/adt-bundle-mac-x86_64-20130522/sdk/platform-tools
=== CLEAN TARGET uraAseag OF PROJECT uraClient WITH CONFIGURATION Debug ===

<... log messages ..>

** CLEAN SUCCEEDED **

/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:Desktop/adt-bundle-mac-x86_64-20130522/sdk/platform-tools
xcodebuild: command not found
/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:Desktop/adt-bundle-mac-x86_64-20130522/sdk/platform-tools









share|improve this question




















  • 1




    Can you launch pwd before and after you run this script ? xcodebuild seems to change the working directory.
    – kranteg
    Jun 27 '14 at 7:52






  • 1




    Perhaps xcodebuild makes change to your PATH variable. Can you add echo $PATH to your script instead of pwd ?
    – kranteg
    Jun 30 '14 at 8:42






  • 1




    It should work if you use absolute path, so use /usr/bin/xcodebuild in your script. But I don't understand why it's not working.
    – kranteg
    Jun 30 '14 at 13:24






  • 1




    You can pass multiple actions to single invocation: clean archive. What is the purpose of ; at the end of the command?
    – Opal
    Jun 30 '14 at 16:47








  • 1




    @kranteg & Opal: I've found a working solution by combining your suggestions. Many Thanks!
    – Chris
    Jul 2 '14 at 7:39














0












0








0







Hi I have the following in the root of my xcode project:



#!/bin/bash
xcodebuild -scheme target1 clean;
xcodebuild -scheme target1 archive;
xcodebuild -scheme target2 clean;
xcodebuild -scheme target2 archive;


However, this only executes the first line xcodebuild -scheme target1 clean; and then yields



...
** CLEAN SUCCEEDED **

xcodebuild: command not found
xcodebuild: command not found
xcodebuild: command not found


Disclaimer: I'm an absolute Mac OS X / Unix greenhorn.



Edit: Following kranteg's suggestion I added pwd to the script:



#!/bin/bash
pwd;
xcodebuild -scheme target1 clean;
pwd;
xcodebuild -scheme target1 archive;
pwd;
xcodebuild -scheme target2 clean;
pwd;
xcodebuild -scheme target2 archive;
pwd;


The output:



/Users/CKU/Programme/uraClient
=== CLEAN TARGET uraClient OF PROJECT uraClient WITH CONFIGURATION Debug ===

Check dependencies

<... lots of compiler messages about the clean ...>

** CLEAN SUCCEEDED **

/Users/CKU/Programme/uraClient
xcodebuild: command not found
/Users/CKU/Programme/uraClient
xcodebuild: command not found
/Users/CKU/Programme/uraClient
xcodebuild: command not found
/Users/CKU/Programme/uraClient


Edit 2: Replacing the pwd with echo $PATH yields a better result, now the script performs the first three xcodebuild commands before failing. However, the PATH variable seems to be unaffected by xcodebuild:



/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:Desktop/adt-bundle-mac-x86_64-20130522/sdk/platform-tools
=== CLEAN TARGET uraClient OF PROJECT uraClient WITH CONFIGURATION Debug ===

<... log messages ...>

** CLEAN SUCCEEDED **

/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:Desktop/adt-bundle-mac-x86_64-20130522/sdk/platform-tools
=== BUILD TARGET uraClient OF PROJECT uraClient WITH CONFIGURATION Release ===

<... log messages ...>

** ARCHIVE SUCCEEDED **


The following commands produced analyzer issues:
AnalyzeShallow uraClient/SQLiteLibrary/SQLiteManager.m
AnalyzeShallow uraClient/URA/NSString+UrlEncoding.m
AnalyzeShallow uraClient/Services/UraTripPredictionsProvider.m
AnalyzeShallow uraClient/UtilityAppViewController/ViewController.m
AnalyzeShallow uraClient/RNCryptor/RNDecryptor.m
AnalyzeShallow uraClient/RNCryptor/RNEncryptor.m
AnalyzeShallow uraClient/RNCryptor/RNOpenSSLCryptor.m
AnalyzeShallow uraClient/RNCryptor/RNOpenSSLDecryptor.m
AnalyzeShallow uraClient/RNCryptor/RNOpenSSLEncryptor.m
(9 commands with analyzer issues)
/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:Desktop/adt-bundle-mac-x86_64-20130522/sdk/platform-tools
=== CLEAN TARGET uraAseag OF PROJECT uraClient WITH CONFIGURATION Debug ===

<... log messages ..>

** CLEAN SUCCEEDED **

/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:Desktop/adt-bundle-mac-x86_64-20130522/sdk/platform-tools
xcodebuild: command not found
/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:Desktop/adt-bundle-mac-x86_64-20130522/sdk/platform-tools









share|improve this question















Hi I have the following in the root of my xcode project:



#!/bin/bash
xcodebuild -scheme target1 clean;
xcodebuild -scheme target1 archive;
xcodebuild -scheme target2 clean;
xcodebuild -scheme target2 archive;


However, this only executes the first line xcodebuild -scheme target1 clean; and then yields



...
** CLEAN SUCCEEDED **

xcodebuild: command not found
xcodebuild: command not found
xcodebuild: command not found


Disclaimer: I'm an absolute Mac OS X / Unix greenhorn.



Edit: Following kranteg's suggestion I added pwd to the script:



#!/bin/bash
pwd;
xcodebuild -scheme target1 clean;
pwd;
xcodebuild -scheme target1 archive;
pwd;
xcodebuild -scheme target2 clean;
pwd;
xcodebuild -scheme target2 archive;
pwd;


The output:



/Users/CKU/Programme/uraClient
=== CLEAN TARGET uraClient OF PROJECT uraClient WITH CONFIGURATION Debug ===

Check dependencies

<... lots of compiler messages about the clean ...>

** CLEAN SUCCEEDED **

/Users/CKU/Programme/uraClient
xcodebuild: command not found
/Users/CKU/Programme/uraClient
xcodebuild: command not found
/Users/CKU/Programme/uraClient
xcodebuild: command not found
/Users/CKU/Programme/uraClient


Edit 2: Replacing the pwd with echo $PATH yields a better result, now the script performs the first three xcodebuild commands before failing. However, the PATH variable seems to be unaffected by xcodebuild:



/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:Desktop/adt-bundle-mac-x86_64-20130522/sdk/platform-tools
=== CLEAN TARGET uraClient OF PROJECT uraClient WITH CONFIGURATION Debug ===

<... log messages ...>

** CLEAN SUCCEEDED **

/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:Desktop/adt-bundle-mac-x86_64-20130522/sdk/platform-tools
=== BUILD TARGET uraClient OF PROJECT uraClient WITH CONFIGURATION Release ===

<... log messages ...>

** ARCHIVE SUCCEEDED **


The following commands produced analyzer issues:
AnalyzeShallow uraClient/SQLiteLibrary/SQLiteManager.m
AnalyzeShallow uraClient/URA/NSString+UrlEncoding.m
AnalyzeShallow uraClient/Services/UraTripPredictionsProvider.m
AnalyzeShallow uraClient/UtilityAppViewController/ViewController.m
AnalyzeShallow uraClient/RNCryptor/RNDecryptor.m
AnalyzeShallow uraClient/RNCryptor/RNEncryptor.m
AnalyzeShallow uraClient/RNCryptor/RNOpenSSLCryptor.m
AnalyzeShallow uraClient/RNCryptor/RNOpenSSLDecryptor.m
AnalyzeShallow uraClient/RNCryptor/RNOpenSSLEncryptor.m
(9 commands with analyzer issues)
/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:Desktop/adt-bundle-mac-x86_64-20130522/sdk/platform-tools
=== CLEAN TARGET uraAseag OF PROJECT uraClient WITH CONFIGURATION Debug ===

<... log messages ..>

** CLEAN SUCCEEDED **

/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:Desktop/adt-bundle-mac-x86_64-20130522/sdk/platform-tools
xcodebuild: command not found
/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:Desktop/adt-bundle-mac-x86_64-20130522/sdk/platform-tools






xcode bash sh xcodebuild






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jun 30 '14 at 9:49

























asked Jun 27 '14 at 6:22









Chris

2,10432443




2,10432443








  • 1




    Can you launch pwd before and after you run this script ? xcodebuild seems to change the working directory.
    – kranteg
    Jun 27 '14 at 7:52






  • 1




    Perhaps xcodebuild makes change to your PATH variable. Can you add echo $PATH to your script instead of pwd ?
    – kranteg
    Jun 30 '14 at 8:42






  • 1




    It should work if you use absolute path, so use /usr/bin/xcodebuild in your script. But I don't understand why it's not working.
    – kranteg
    Jun 30 '14 at 13:24






  • 1




    You can pass multiple actions to single invocation: clean archive. What is the purpose of ; at the end of the command?
    – Opal
    Jun 30 '14 at 16:47








  • 1




    @kranteg & Opal: I've found a working solution by combining your suggestions. Many Thanks!
    – Chris
    Jul 2 '14 at 7:39














  • 1




    Can you launch pwd before and after you run this script ? xcodebuild seems to change the working directory.
    – kranteg
    Jun 27 '14 at 7:52






  • 1




    Perhaps xcodebuild makes change to your PATH variable. Can you add echo $PATH to your script instead of pwd ?
    – kranteg
    Jun 30 '14 at 8:42






  • 1




    It should work if you use absolute path, so use /usr/bin/xcodebuild in your script. But I don't understand why it's not working.
    – kranteg
    Jun 30 '14 at 13:24






  • 1




    You can pass multiple actions to single invocation: clean archive. What is the purpose of ; at the end of the command?
    – Opal
    Jun 30 '14 at 16:47








  • 1




    @kranteg & Opal: I've found a working solution by combining your suggestions. Many Thanks!
    – Chris
    Jul 2 '14 at 7:39








1




1




Can you launch pwd before and after you run this script ? xcodebuild seems to change the working directory.
– kranteg
Jun 27 '14 at 7:52




Can you launch pwd before and after you run this script ? xcodebuild seems to change the working directory.
– kranteg
Jun 27 '14 at 7:52




1




1




Perhaps xcodebuild makes change to your PATH variable. Can you add echo $PATH to your script instead of pwd ?
– kranteg
Jun 30 '14 at 8:42




Perhaps xcodebuild makes change to your PATH variable. Can you add echo $PATH to your script instead of pwd ?
– kranteg
Jun 30 '14 at 8:42




1




1




It should work if you use absolute path, so use /usr/bin/xcodebuild in your script. But I don't understand why it's not working.
– kranteg
Jun 30 '14 at 13:24




It should work if you use absolute path, so use /usr/bin/xcodebuild in your script. But I don't understand why it's not working.
– kranteg
Jun 30 '14 at 13:24




1




1




You can pass multiple actions to single invocation: clean archive. What is the purpose of ; at the end of the command?
– Opal
Jun 30 '14 at 16:47






You can pass multiple actions to single invocation: clean archive. What is the purpose of ; at the end of the command?
– Opal
Jun 30 '14 at 16:47






1




1




@kranteg & Opal: I've found a working solution by combining your suggestions. Many Thanks!
– Chris
Jul 2 '14 at 7:39




@kranteg & Opal: I've found a working solution by combining your suggestions. Many Thanks!
– Chris
Jul 2 '14 at 7:39












3 Answers
3






active

oldest

votes


















3














With the help of kranteg & Opal I've come up with a working solution:



#!/bin/bash
/usr/bin/xcodebuild -scheme target1 clean archive;
/usr/bin/xcodebuild -scheme target2 clean archive;
/usr/bin/xcodebuild -scheme target3 clean archive;
<...>


Thanks again for the relentless community support, I would have given up otherwise :-)



Note: I've found that each scheme has a post-action step for the "Archive" action, that I had forgotten about:



xcrun -sdk iphoneos PackageApplication "$ARCHIVE_PRODUCTS_PATH/$INSTALL_PATH/$WRAPPER_NAME" -o "${HOME}/Desktop/${PRODUCT_NAME}.ipa"


This automatically creates .ipa files for Ad-Hoc deployment. Maybe this interfered with the original build script by changing a working directory. However, I don't understand why that would not register with the pwd and echo $PATH logging.






share|improve this answer























  • Possible that after the command failed it performed a "cd" back to it's original directory before the printworkingdirectory command was called.
    – Acludia
    Oct 10 '14 at 23:32



















1














Make sure that you've installed Xcode's command line tools. Go to the Xcode->Preferences... Command and look for the panel that lets you download additional packages and documentation. IIRC, the command line tools can be installed from there.






share|improve this answer





















  • Hi, the command line tools are installed and working, otherwise the first clean would fail as well. In fact, all commands from the script work when entered manually in the terminal.
    – Chris
    Jun 30 '14 at 7:40



















0














xcodebuild command will not work when Command Lines Tools is not setup for xcode.



Make sure that latest command line tools are selected (Under Xcode > Preferences > Locations)



enter image description here






share|improve this answer





















    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f24445229%2fwhy-is-xcodebuild-command-not-found-in-this-build-script%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    3 Answers
    3






    active

    oldest

    votes








    3 Answers
    3






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    3














    With the help of kranteg & Opal I've come up with a working solution:



    #!/bin/bash
    /usr/bin/xcodebuild -scheme target1 clean archive;
    /usr/bin/xcodebuild -scheme target2 clean archive;
    /usr/bin/xcodebuild -scheme target3 clean archive;
    <...>


    Thanks again for the relentless community support, I would have given up otherwise :-)



    Note: I've found that each scheme has a post-action step for the "Archive" action, that I had forgotten about:



    xcrun -sdk iphoneos PackageApplication "$ARCHIVE_PRODUCTS_PATH/$INSTALL_PATH/$WRAPPER_NAME" -o "${HOME}/Desktop/${PRODUCT_NAME}.ipa"


    This automatically creates .ipa files for Ad-Hoc deployment. Maybe this interfered with the original build script by changing a working directory. However, I don't understand why that would not register with the pwd and echo $PATH logging.






    share|improve this answer























    • Possible that after the command failed it performed a "cd" back to it's original directory before the printworkingdirectory command was called.
      – Acludia
      Oct 10 '14 at 23:32
















    3














    With the help of kranteg & Opal I've come up with a working solution:



    #!/bin/bash
    /usr/bin/xcodebuild -scheme target1 clean archive;
    /usr/bin/xcodebuild -scheme target2 clean archive;
    /usr/bin/xcodebuild -scheme target3 clean archive;
    <...>


    Thanks again for the relentless community support, I would have given up otherwise :-)



    Note: I've found that each scheme has a post-action step for the "Archive" action, that I had forgotten about:



    xcrun -sdk iphoneos PackageApplication "$ARCHIVE_PRODUCTS_PATH/$INSTALL_PATH/$WRAPPER_NAME" -o "${HOME}/Desktop/${PRODUCT_NAME}.ipa"


    This automatically creates .ipa files for Ad-Hoc deployment. Maybe this interfered with the original build script by changing a working directory. However, I don't understand why that would not register with the pwd and echo $PATH logging.






    share|improve this answer























    • Possible that after the command failed it performed a "cd" back to it's original directory before the printworkingdirectory command was called.
      – Acludia
      Oct 10 '14 at 23:32














    3












    3








    3






    With the help of kranteg & Opal I've come up with a working solution:



    #!/bin/bash
    /usr/bin/xcodebuild -scheme target1 clean archive;
    /usr/bin/xcodebuild -scheme target2 clean archive;
    /usr/bin/xcodebuild -scheme target3 clean archive;
    <...>


    Thanks again for the relentless community support, I would have given up otherwise :-)



    Note: I've found that each scheme has a post-action step for the "Archive" action, that I had forgotten about:



    xcrun -sdk iphoneos PackageApplication "$ARCHIVE_PRODUCTS_PATH/$INSTALL_PATH/$WRAPPER_NAME" -o "${HOME}/Desktop/${PRODUCT_NAME}.ipa"


    This automatically creates .ipa files for Ad-Hoc deployment. Maybe this interfered with the original build script by changing a working directory. However, I don't understand why that would not register with the pwd and echo $PATH logging.






    share|improve this answer














    With the help of kranteg & Opal I've come up with a working solution:



    #!/bin/bash
    /usr/bin/xcodebuild -scheme target1 clean archive;
    /usr/bin/xcodebuild -scheme target2 clean archive;
    /usr/bin/xcodebuild -scheme target3 clean archive;
    <...>


    Thanks again for the relentless community support, I would have given up otherwise :-)



    Note: I've found that each scheme has a post-action step for the "Archive" action, that I had forgotten about:



    xcrun -sdk iphoneos PackageApplication "$ARCHIVE_PRODUCTS_PATH/$INSTALL_PATH/$WRAPPER_NAME" -o "${HOME}/Desktop/${PRODUCT_NAME}.ipa"


    This automatically creates .ipa files for Ad-Hoc deployment. Maybe this interfered with the original build script by changing a working directory. However, I don't understand why that would not register with the pwd and echo $PATH logging.







    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited Jul 3 '14 at 6:21

























    answered Jul 2 '14 at 7:48









    Chris

    2,10432443




    2,10432443












    • Possible that after the command failed it performed a "cd" back to it's original directory before the printworkingdirectory command was called.
      – Acludia
      Oct 10 '14 at 23:32


















    • Possible that after the command failed it performed a "cd" back to it's original directory before the printworkingdirectory command was called.
      – Acludia
      Oct 10 '14 at 23:32
















    Possible that after the command failed it performed a "cd" back to it's original directory before the printworkingdirectory command was called.
    – Acludia
    Oct 10 '14 at 23:32




    Possible that after the command failed it performed a "cd" back to it's original directory before the printworkingdirectory command was called.
    – Acludia
    Oct 10 '14 at 23:32













    1














    Make sure that you've installed Xcode's command line tools. Go to the Xcode->Preferences... Command and look for the panel that lets you download additional packages and documentation. IIRC, the command line tools can be installed from there.






    share|improve this answer





















    • Hi, the command line tools are installed and working, otherwise the first clean would fail as well. In fact, all commands from the script work when entered manually in the terminal.
      – Chris
      Jun 30 '14 at 7:40
















    1














    Make sure that you've installed Xcode's command line tools. Go to the Xcode->Preferences... Command and look for the panel that lets you download additional packages and documentation. IIRC, the command line tools can be installed from there.






    share|improve this answer





















    • Hi, the command line tools are installed and working, otherwise the first clean would fail as well. In fact, all commands from the script work when entered manually in the terminal.
      – Chris
      Jun 30 '14 at 7:40














    1












    1








    1






    Make sure that you've installed Xcode's command line tools. Go to the Xcode->Preferences... Command and look for the panel that lets you download additional packages and documentation. IIRC, the command line tools can be installed from there.






    share|improve this answer












    Make sure that you've installed Xcode's command line tools. Go to the Xcode->Preferences... Command and look for the panel that lets you download additional packages and documentation. IIRC, the command line tools can be installed from there.







    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered Jun 28 '14 at 3:37









    Caleb

    109k16150238




    109k16150238












    • Hi, the command line tools are installed and working, otherwise the first clean would fail as well. In fact, all commands from the script work when entered manually in the terminal.
      – Chris
      Jun 30 '14 at 7:40


















    • Hi, the command line tools are installed and working, otherwise the first clean would fail as well. In fact, all commands from the script work when entered manually in the terminal.
      – Chris
      Jun 30 '14 at 7:40
















    Hi, the command line tools are installed and working, otherwise the first clean would fail as well. In fact, all commands from the script work when entered manually in the terminal.
    – Chris
    Jun 30 '14 at 7:40




    Hi, the command line tools are installed and working, otherwise the first clean would fail as well. In fact, all commands from the script work when entered manually in the terminal.
    – Chris
    Jun 30 '14 at 7:40











    0














    xcodebuild command will not work when Command Lines Tools is not setup for xcode.



    Make sure that latest command line tools are selected (Under Xcode > Preferences > Locations)



    enter image description here






    share|improve this answer


























      0














      xcodebuild command will not work when Command Lines Tools is not setup for xcode.



      Make sure that latest command line tools are selected (Under Xcode > Preferences > Locations)



      enter image description here






      share|improve this answer
























        0












        0








        0






        xcodebuild command will not work when Command Lines Tools is not setup for xcode.



        Make sure that latest command line tools are selected (Under Xcode > Preferences > Locations)



        enter image description here






        share|improve this answer












        xcodebuild command will not work when Command Lines Tools is not setup for xcode.



        Make sure that latest command line tools are selected (Under Xcode > Preferences > Locations)



        enter image description here







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 20 at 13:44









        Saif

        1,2231923




        1,2231923






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.





            Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


            Please pay close attention to the following guidance:


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f24445229%2fwhy-is-xcodebuild-command-not-found-in-this-build-script%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Create new schema in PostgreSQL using DBeaver

            Deepest pit of an array with Javascript: test on Codility

            Costa Masnaga