Xcode error in ElCapitain MRtrix install

HI
This is my first time on the forum. I tried installing MRtrix on a Mac with El Capitain (10.11.6), following all the instructions as per http://mrtrix.readthedocs.io/en/latest/installation/mac_install.html

When I get to the .configure step I get an Xcode-related error:

ERROR: qmake returned with error:

Project ERROR: Xcode not set up properly. You may need to confirm the license agreement by running /usr/bin/xcodebuild.

ERROR: unexpected exception!

When I run the xcodebuilt as suggested it says:

jfh$ /usr/bin/xcodebuild
xcodebuild: error: The directory /Users/jfh/mrtrix3/mrtrix3 does not contain an Xcode project.

I’m not familiar with setting up an Xcode project and I see there are many options as to project choice.

Below I’ve copied the full configure.log file

REPORT: 
MRtrix build type requested:

REPORT: release

REPORT: 

REPORT: Detecting OS: darwin
EXEC <<
CMD: sw_vers -productVersion
EXIT: 0
STDOUT:
10.11.6
>>


REPORT: OS X deployment target: 10.11

REPORT: Checking for C++11 compliant compiler [clang++]:
EXEC <<
CMD: clang++ -dumpversion
EXIT: 0
STDOUT:
4.2.1
>>


REPORT: 4.2.1

COMPILE /var/folders/m8/r202cc_d2m5cdz_9_11d6tr80000gn/T/tmp3252b2j8.cpp:
---

struct Base {
    Base (int);
};
struct Derived : Base {
    using Base::Base;
};

int main() {
  Derived D (int); // check for contructor inheritance
  return (0);
}

---
EXEC <<
CMD: clang++ -c -std=c++11 -DMRTRIX_MACOSX -fPIC -mmacosx-version-min=10.11 /var/folders/m8/r202cc_d2m5cdz_9_11d6tr80000gn/T/tmp3252b2j8.cpp -o /var/folders/m8/r202cc_d2m5cdz_9_11d6tr80000gn/T/tmp3252b2j8.o
EXIT: 0
>>

EXEC <<
CMD: clang++ /var/folders/m8/r202cc_d2m5cdz_9_11d6tr80000gn/T/tmp3252b2j8.o -mmacosx-version-min=10.11 -o a.out
EXIT: 0
>>

EXEC <<
CMD: ./a.out
EXIT: 0
>>


REPORT:  - tested ok

REPORT: Detecting pointer size:

COMPILE /var/folders/m8/r202cc_d2m5cdz_9_11d6tr80000gn/T/tmpcws418mo.cpp:
---

#include <iostream>
int main() {
  std::cout << sizeof(void*);
  return (0);
}

---
EXEC <<
CMD: clang++ -c -std=c++11 -DMRTRIX_MACOSX -fPIC -mmacosx-version-min=10.11 /var/folders/m8/r202cc_d2m5cdz_9_11d6tr80000gn/T/tmpcws418mo.cpp -o /var/folders/m8/r202cc_d2m5cdz_9_11d6tr80000gn/T/tmpcws418mo.o
EXIT: 0
>>

EXEC <<
CMD: clang++ /var/folders/m8/r202cc_d2m5cdz_9_11d6tr80000gn/T/tmpcws418mo.o -mmacosx-version-min=10.11 -o a.out
EXIT: 0
>>

EXEC <<
CMD: ./a.out
EXIT: 0
STDOUT:
8
>>


REPORT: 64 bit

REPORT: Detecting byte order:

REPORT: little-endian

REPORT: Checking for variable-length array support:

COMPILE /var/folders/m8/r202cc_d2m5cdz_9_11d6tr80000gn/T/tmp06mxhjee.cpp:
---


int main(int argc, char* argv[]) {
  int x[argc];
  return 0;
}

---
EXEC <<
CMD: clang++ -c -std=c++11 -DMRTRIX_MACOSX -fPIC -mmacosx-version-min=10.11 -DMRTRIX_WORD64 /var/folders/m8/r202cc_d2m5cdz_9_11d6tr80000gn/T/tmp06mxhjee.cpp -o /var/folders/m8/r202cc_d2m5cdz_9_11d6tr80000gn/T/tmp06mxhjee.o
EXIT: 0
>>

EXEC <<
CMD: clang++ /var/folders/m8/r202cc_d2m5cdz_9_11d6tr80000gn/T/tmp06mxhjee.o -mmacosx-version-min=10.11 -o a.out
EXIT: 0
>>

EXEC <<
CMD: ./a.out
EXIT: 0
>>


REPORT: yes

REPORT: Checking for non-POD variable-length array support:

COMPILE /var/folders/m8/r202cc_d2m5cdz_9_11d6tr80000gn/T/tmpvhum2edy.cpp:
---

#include <string>

class X {
  int x;
  double y;
  std::string s;
};

int main(int argc, char* argv[]) {
  X x[argc];
  return 0;
}

---
EXEC <<
CMD: clang++ -c -std=c++11 -DMRTRIX_MACOSX -fPIC -mmacosx-version-min=10.11 -DMRTRIX_WORD64 /var/folders/m8/r202cc_d2m5cdz_9_11d6tr80000gn/T/tmpvhum2edy.cpp -o /var/folders/m8/r202cc_d2m5cdz_9_11d6tr80000gn/T/tmpvhum2edy.o
EXIT: 1
STDERR:
/var/folders/m8/r202cc_d2m5cdz_9_11d6tr80000gn/T/tmpvhum2edy.cpp:11:6: error: variable length array of non-POD element type 'X'
  X x[argc];
     ^
1 error generated.
>>

error deleting temporary file "/var/folders/m8/r202cc_d2m5cdz_9_11d6tr80000gn/T/tmpvhum2edy.o": No such file or directory
REPORT: no

REPORT: Checking for zlib compression library:

COMPILE /var/folders/m8/r202cc_d2m5cdz_9_11d6tr80000gn/T/tmp0ergl94a.cpp:
---

#include <iostream>
#include <zlib.h>

int main() {
  std::cout << zlibVersion();
  return (0);
}

---
EXEC <<
CMD: clang++ -c -std=c++11 -DMRTRIX_MACOSX -fPIC -mmacosx-version-min=10.11 -DMRTRIX_WORD64 -DMRTRIX_NO_NON_POD_VLA /var/folders/m8/r202cc_d2m5cdz_9_11d6tr80000gn/T/tmp0ergl94a.cpp -o /var/folders/m8/r202cc_d2m5cdz_9_11d6tr80000gn/T/tmp0ergl94a.o
EXIT: 0
>>

EXEC <<
CMD: clang++ /var/folders/m8/r202cc_d2m5cdz_9_11d6tr80000gn/T/tmp0ergl94a.o -mmacosx-version-min=10.11 -lz -o a.out
EXIT: 0
>>

EXEC <<
CMD: ./a.out
EXIT: 0
STDOUT:
1.2.5
>>


REPORT: 1.2.5

REPORT: Checking for Eigen 3 library:
EXEC <<
CMD: pkg-config --cflags eigen3
EXIT: 0
STDOUT:
-I/usr/local/Cellar/eigen/3.2.9/include/eigen3
>>


COMPILE /var/folders/m8/r202cc_d2m5cdz_9_11d6tr80000gn/T/tmprcuz60ka.cpp:
---

#include <Eigen/Core>
#include <iostream>

int main (int argc, char* argv[]) {
  std::cout << EIGEN_WORLD_VERSION << "." << EIGEN_MAJOR_VERSION << "." << EIGEN_MINOR_VERSION << "\n";
  return 0;
}

---
EXEC <<
CMD: clang++ -c -std=c++11 -DMRTRIX_MACOSX -fPIC -mmacosx-version-min=10.11 -DMRTRIX_WORD64 -DMRTRIX_NO_NON_POD_VLA -isystem /usr/local/Cellar/eigen/3.2.9/include/eigen3 /var/folders/m8/r202cc_d2m5cdz_9_11d6tr80000gn/T/tmprcuz60ka.cpp -o /var/folders/m8/r202cc_d2m5cdz_9_11d6tr80000gn/T/tmprcuz60ka.o
EXIT: 0
>>

EXEC <<
CMD: clang++ /var/folders/m8/r202cc_d2m5cdz_9_11d6tr80000gn/T/tmprcuz60ka.o -mmacosx-version-min=10.11 -lz -o a.out
EXIT: 0
>>

EXEC <<
CMD: ./a.out
EXIT: 0
STDOUT:
3.2.9
>>


REPORT: 3.2.9

REPORT: Checking shared library generation:
EXEC <<
CMD: clang++ -c -std=c++11 -DMRTRIX_MACOSX -fPIC -mmacosx-version-min=10.11 -DMRTRIX_WORD64 -DMRTRIX_NO_NON_POD_VLA -isystem /usr/local/Cellar/eigen/3.2.9/include/eigen3 /var/folders/m8/r202cc_d2m5cdz_9_11d6tr80000gn/T/tmptkf82_7u.cpp -o /var/folders/m8/r202cc_d2m5cdz_9_11d6tr80000gn/T/tmptkf82_7u.o
EXIT: 0
>>

EXEC <<
CMD: clang++ /var/folders/m8/r202cc_d2m5cdz_9_11d6tr80000gn/T/tmptkf82_7u.o -dynamiclib -install_name @rpath/LIBNAME -mmacosx-version-min=10.11 -mmacosx-version-min=10.11 -lz -o libtest.dylib
EXIT: 0
>>


REPORT: yes

REPORT: Checking for Qt moc:
EXEC <<
CMD: moc -v
EXIT: 0
STDOUT:
moc 5.6.1
>>


REPORT: moc (version 5.6.1)

REPORT: Checking for Qt qmake:
EXEC <<
CMD: qmake -v
EXIT: 0
STDOUT:
QMake version 3.0
Using Qt version 5.6.1 in /usr/local/Cellar/qt5/5.6.1-1/lib
>>


REPORT: qmake (version 5.6.1)

REPORT: Checking for Qt rcc:
EXEC <<
CMD: rcc -v
EXIT: 0
STDOUT:
rcc 5.6.1
>>


REPORT: rcc (version 5.6.1)

REPORT: Checking for Qt:

source file "qt.h":
---
#include <QObject>

class Foo: public QObject {
  Q_OBJECT;
  public:
    Foo();
    ~Foo();
  public slots:
    void setValue(int value);
  signals:
    void valueChanged (int newValue);
  private:
    int value_;
};
---

source file "qt.cpp":
---
#include <iostream>
#include "qt.h"

Foo::Foo() : value_ (42) { connect (this, SIGNAL(valueChanged(int)), this, SLOT(setValue(int))); }

Foo::~Foo() { std::cout << qVersion() << "\n"; }

void Foo::setValue (int value) { value_ = value; }

int main() { Foo f; }
---

project file "qt.pro":
---
CONFIG += c++11
QT += core gui opengl svg
HEADERS += qt.h
SOURCES += qt.cpp
QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.11
---
EXEC <<
CMD: qmake
EXIT: 3
STDERR:
Project ERROR: Xcode not set up properly. You may need to confirm the license agreement by running /usr/bin/xcodebuild.
>>


ERROR: qmake returned with error:

Project ERROR: Xcode not set up properly. You may need to confirm the license agreement by running /usr/bin/xcodebuild.


ERROR: unexpected exception!

  See the file 'configure.log' for details. If this doesn't help and you need
  further assistance, please post on the MRtrix3 community forum
  (http://community.mrtrix.org/), and make sure to include the full contents of
  the 'configure.log' file.
  
  jfh$ /usr/bin/xcodebuild
xcodebuild: error: The directory /Users/jfh/mrtrix3/mrtrix3 does not contain an Xcode project.

It looks like you haven’t accepted XCode’s licence agreement. Just start the XCode application itself, it should pop up a notice asking you to agree to their terms and conditions. You can quit XCode as soon as you’ve done that, and then try ./configure again…

Im getting the same error and I have installed and uninstalled Xcode and I still get this error message. I have used the following commands in to try to get around it and was successful once but then still generated a Qt moc compiler error. Since then I have not been able to get around this Xcode issue again, even after reinstalling it. Xcode opens fine and I have accepted the license agreement. It’s quite the challenge to get this software package to install.

I’ve even tried the following which allows me to accept the license from the shell:

sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer

sudo xcodebuild -license

#################################################################
Configure Log

REPORT: 
MRtrix build type requested:

REPORT: release

REPORT: 

REPORT: Detecting OS: darwin
EXEC <<
CMD: sw_vers -productVersion
EXIT: 0
STDOUT:
10.11.6
>>


REPORT: OS X deployment target: 10.11

REPORT: Checking for C++11 compliant compiler [clang++]:
EXEC <<
CMD: clang++ -dumpversion
EXIT: 0
STDOUT:
4.2.1
>>


REPORT: 4.2.1

COMPILE /var/folders/f9/zvmzv53d6pdbq27t_350_krm0000gq/T/tmpVkyctR.cpp:
---

struct Base {
    Base (int);
};
struct Derived : Base {
    using Base::Base;
};

int main() {
  Derived D (int); // check for contructor inheritance
  return (0);
}

---
EXEC <<
CMD: clang++ -c -std=c++11 -DMRTRIX_MACOSX -fPIC -mmacosx-version-min=10.11 /var/folders/f9/zvmzv53d6pdbq27t_350_krm0000gq/T/tmpVkyctR.cpp -o /var/folders/f9/zvmzv53d6pdbq27t_350_krm0000gq/T/tmpVkyctR.o
EXIT: 0
>>

EXEC <<
CMD: clang++ /var/folders/f9/zvmzv53d6pdbq27t_350_krm0000gq/T/tmpVkyctR.o -mmacosx-version-min=10.11 -o a.out
EXIT: 0
>>

EXEC <<
CMD: ./a.out
EXIT: 0
>>


REPORT:  - tested ok

REPORT: Detecting pointer size:

COMPILE /var/folders/f9/zvmzv53d6pdbq27t_350_krm0000gq/T/tmpmxFUMv.cpp:
---

#include <iostream>
int main() {
  std::cout << sizeof(void*);
  return (0);
}

---
EXEC <<
CMD: clang++ -c -std=c++11 -DMRTRIX_MACOSX -fPIC -mmacosx-version-min=10.11 /var/folders/f9/zvmzv53d6pdbq27t_350_krm0000gq/T/tmpmxFUMv.cpp -o /var/folders/f9/zvmzv53d6pdbq27t_350_krm0000gq/T/tmpmxFUMv.o
EXIT: 0
>>

EXEC <<
CMD: clang++ /var/folders/f9/zvmzv53d6pdbq27t_350_krm0000gq/T/tmpmxFUMv.o -mmacosx-version-min=10.11 -o a.out
EXIT: 0
>>

EXEC <<
CMD: ./a.out
EXIT: 0
STDOUT:
8
>>


REPORT: 64 bit

REPORT: Detecting byte order:

REPORT: little-endian

REPORT: Checking for variable-length array support:

COMPILE /var/folders/f9/zvmzv53d6pdbq27t_350_krm0000gq/T/tmp830owr.cpp:
---


int main(int argc, char* argv[]) {
  int x[argc];
  return 0;
}

---
EXEC <<
CMD: clang++ -c -std=c++11 -DMRTRIX_MACOSX -fPIC -mmacosx-version-min=10.11 -DMRTRIX_WORD64 /var/folders/f9/zvmzv53d6pdbq27t_350_krm0000gq/T/tmp830owr.cpp -o /var/folders/f9/zvmzv53d6pdbq27t_350_krm0000gq/T/tmp830owr.o
EXIT: 0
>>

EXEC <<
CMD: clang++ /var/folders/f9/zvmzv53d6pdbq27t_350_krm0000gq/T/tmp830owr.o -mmacosx-version-min=10.11 -o a.out
EXIT: 0
>>

EXEC <<
CMD: ./a.out
EXIT: 0
>>


REPORT: yes

REPORT: Checking for non-POD variable-length array support:

COMPILE /var/folders/f9/zvmzv53d6pdbq27t_350_krm0000gq/T/tmp50qtFx.cpp:
---

#include <string>

class X {
  int x;
  double y;
  std::string s;
};

int main(int argc, char* argv[]) {
  X x[argc];
  return 0;
}

---
EXEC <<
CMD: clang++ -c -std=c++11 -DMRTRIX_MACOSX -fPIC -mmacosx-version-min=10.11 -DMRTRIX_WORD64 /var/folders/f9/zvmzv53d6pdbq27t_350_krm0000gq/T/tmp50qtFx.cpp -o /var/folders/f9/zvmzv53d6pdbq27t_350_krm0000gq/T/tmp50qtFx.o
EXIT: 1
STDERR:
/var/folders/f9/zvmzv53d6pdbq27t_350_krm0000gq/T/tmp50qtFx.cpp:11:6: error: variable length array of non-POD element type 'X'
  X x[argc];
     ^
1 error generated.
>>

error deleting temporary file "/var/folders/f9/zvmzv53d6pdbq27t_350_krm0000gq/T/tmp50qtFx.o": No such file or directory
REPORT: no

REPORT: Checking for zlib compression library:

COMPILE /var/folders/f9/zvmzv53d6pdbq27t_350_krm0000gq/T/tmp7CCvVk.cpp:
---

#include <iostream>
#include <zlib.h>

int main() {
  std::cout << zlibVersion();
  return (0);
}

---
EXEC <<
CMD: clang++ -c -std=c++11 -DMRTRIX_MACOSX -fPIC -mmacosx-version-min=10.11 -DMRTRIX_WORD64 -DMRTRIX_NO_NON_POD_VLA /var/folders/f9/zvmzv53d6pdbq27t_350_krm0000gq/T/tmp7CCvVk.cpp -o /var/folders/f9/zvmzv53d6pdbq27t_350_krm0000gq/T/tmp7CCvVk.o
EXIT: 0
>>

EXEC <<
CMD: clang++ /var/folders/f9/zvmzv53d6pdbq27t_350_krm0000gq/T/tmp7CCvVk.o -mmacosx-version-min=10.11 -lz -o a.out
EXIT: 0
>>

EXEC <<
CMD: ./a.out
EXIT: 0
STDOUT:
1.2.5
>>


REPORT: 1.2.5

REPORT: Checking for Eigen 3 library:
EXEC <<
CMD: pkg-config --cflags eigen3
EXIT: 0
STDOUT:
-I/usr/local/Cellar/eigen/3.2.9/include/eigen3
>>


COMPILE /var/folders/f9/zvmzv53d6pdbq27t_350_krm0000gq/T/tmpe6D5ME.cpp:
---

#include <Eigen/Core>
#include <iostream>

int main (int argc, char* argv[]) {
  std::cout << EIGEN_WORLD_VERSION << "." << EIGEN_MAJOR_VERSION << "." << EIGEN_MINOR_VERSION << "\n";
  return 0;
}

---
EXEC <<
CMD: clang++ -c -std=c++11 -DMRTRIX_MACOSX -fPIC -mmacosx-version-min=10.11 -DMRTRIX_WORD64 -DMRTRIX_NO_NON_POD_VLA -isystem /usr/local/Cellar/eigen/3.2.9/include/eigen3 /var/folders/f9/zvmzv53d6pdbq27t_350_krm0000gq/T/tmpe6D5ME.cpp -o /var/folders/f9/zvmzv53d6pdbq27t_350_krm0000gq/T/tmpe6D5ME.o
EXIT: 0
>>

EXEC <<
CMD: clang++ /var/folders/f9/zvmzv53d6pdbq27t_350_krm0000gq/T/tmpe6D5ME.o -mmacosx-version-min=10.11 -lz -o a.out
EXIT: 0
>>

EXEC <<
CMD: ./a.out
EXIT: 0
STDOUT:
3.2.9
>>


REPORT: 3.2.9

REPORT: Checking shared library generation:
EXEC <<
CMD: clang++ -c -std=c++11 -DMRTRIX_MACOSX -fPIC -mmacosx-version-min=10.11 -DMRTRIX_WORD64 -DMRTRIX_NO_NON_POD_VLA -isystem /usr/local/Cellar/eigen/3.2.9/include/eigen3 /var/folders/f9/zvmzv53d6pdbq27t_350_krm0000gq/T/tmpjAcutm.cpp -o /var/folders/f9/zvmzv53d6pdbq27t_350_krm0000gq/T/tmpjAcutm.o
EXIT: 0
>>

EXEC <<
CMD: clang++ /var/folders/f9/zvmzv53d6pdbq27t_350_krm0000gq/T/tmpjAcutm.o -dynamiclib -install_name @rpath/LIBNAME -mmacosx-version-min=10.11 -mmacosx-version-min=10.11 -lz -o libtest.dylib
EXIT: 0
>>


REPORT: yes

REPORT: Checking for Qt moc:
EXEC <<
CMD: moc -v
EXIT: 0
STDOUT:
moc 5.6.1
>>


REPORT: moc (version 5.6.1)

REPORT: Checking for Qt qmake:
EXEC <<
CMD: qmake -v
EXIT: 0
STDOUT:
QMake version 3.0
Using Qt version 5.6.1 in /usr/local/Cellar/qt5/5.6.1-1/lib
>>


REPORT: qmake (version 5.6.1)

REPORT: Checking for Qt rcc:
EXEC <<
CMD: rcc -v
EXIT: 0
STDOUT:
rcc 5.6.1
>>


REPORT: rcc (version 5.6.1)

REPORT: Checking for Qt:

source file "qt.h":
---
#include <QObject>

class Foo: public QObject {
  Q_OBJECT;
  public:
    Foo();
    ~Foo();
  public slots:
    void setValue(int value);
  signals:
    void valueChanged (int newValue);
  private:
    int value_;
};
---

source file "qt.cpp":
---
#include <iostream>
#include "qt.h"

Foo::Foo() : value_ (42) { connect (this, SIGNAL(valueChanged(int)), this, SLOT(setValue(int))); }

Foo::~Foo() { std::cout << qVersion() << "\n"; }

void Foo::setValue (int value) { value_ = value; }

int main() { Foo f; }
---

project file "qt.pro":
---
CONFIG += c++11
QT += core gui opengl svg
HEADERS += qt.h
SOURCES += qt.cpp
QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.11
---
EXEC <<
CMD: qmake
EXIT: 3
STDERR:
Project ERROR: Xcode not set up properly. You may need to confirm the license agreement by running /usr/bin/xcodebuild.
>>


ERROR: qmake returned with error:

Project ERROR: Xcode not set up properly. You may need to confirm the license agreement by running /usr/bin/xcodebuild.


ERROR: unexpected exception!

  See the file 'configure.log' for details. If this doesn't help and you need
  further assistance, please post on the MRtrix3 community forum
  (http://community.mrtrix.org/), and make sure to include the full contents of
  the 'configure.log' file.

OK, you’re right, this looks like a different error - if there had been issues with the licence, errors would have been produced much earlier in the process. Only when it runs Qt’s qmake command does it produce this error:

A quick search for this error shows that this is a problem with Qt when building with XCode 8, as reported here and here - nothing to do with XCode as such. There are suggestions on how to fix this on these posts, hopefully they will sort out the problem.

I’m afraid there is nothing we can do to avoid such issues in packages we depend on, unfortunately. It seems Apple have changed the way XCode behaves, and Qt hasn’t been updated to match (although I guess that will be fixed pretty quickly). The one thing we could do is provide pre-compiled packages, which is something we’ve been talking about doing for some time. Maybe we’ll look into it if we find the time. Of course, if anyone is willing to help out on this front, I’m sure there’ll be lots of very grateful users out there… :wink:

I just tried the fix suggested here with QT 5.6.1 and it seems to do the job.

For my system the fix is:

cd `which qmake`/../../
sed -i.bak s/"xcrun -find xcrun 2"/"xcrun -find xcodebuild 2"/g mkspecs/features/mac/default_pre.prf

This might interfere with compiling other projects that use QT but as far as I read, it is fine if those don’t use the iOS simulator.

You can revert that change with

cd `which qmake`/../../
mv mkspecs/features/mac/default_pre.prf.bak mkspecs/features/mac/default_pre.prf

diff:

diff mkspecs/features/mac/default_pre.prf.bak mkspecs/features/mac/default_pre.prf
15c15
<     isEmpty($$list($$system("/usr/bin/xcrun -find xcrun 2>/dev/null"))): \
---
>     isEmpty($$list($$system("/usr/bin/xcrun -find xcodebuild 2>/dev/null"))): \