-
Notifications
You must be signed in to change notification settings - Fork 126
Building Mantid on OS X 10.10 & 10.11 using clang and Xcode
These instructions are from the assumptions of a blank newly installed Mac and want to use the system python. Other python distributions may work but have not been tested.
- First install Xcode and then clone the mantid git repository.
- The last version to support OS X Mavericks is Xcode 6.2
- The last version to support OS X Yosemite is Xcode 7.2.1
- As of August 1, 2016, our OS X El Capitan build server is running Xcode 7.3.1
-
Install Apple's Command Line tools (without this then /usr/include will not exist)
xcode-select --install
-
Install Homebrew. If you already have Homebrew and are upgrading the OS follow the instructions here:
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
-
Add the necessary 'taps'. The last 4 are to use qt4.
In order to be able to 'tap' the mantidproject/mantid
'tap' we need to have a couple of packages installed
brew install git
brew install git-lfs
brew tap homebrew/science
brew tap mantidproject/mantid
brew tap caskroom/cask
brew tap cartr/qt4
brew tap-pin cartr/qt4
-
Install required dependencies (will make a mantid-developer formula soon) If you plan on distributing your application bundle, change
brew install
tobrew install --build-bottle
brew cask install xquartz # mactex is optional, needed for parsing equations in qthelp documentation. brew cask install mactex brew install openssl brew install cmake brew install qt@4 --with-qt3support --build-bottle # sip,pyqt and qscintilla2 bring in homebrew's python if # installed with --build-bottle. And add --build-from-source. brew install sip --build-from-source --without-python3 brew install pyqt@4 --build-from-source --without-python3 brew install qscintilla2qt4 --build-from-source brew install qt --build-bottle brew install pyqt --build-from-source brew install qscintilla2 --build-from-source --without-python3 brew install poco --c++11 brew install boost --c++11 # boost-python brings in homebrew's python if installed with --build-bottle. brew install boost-python --c++11 --build-from-source brew install gsl brew install hdf5 --c++11 brew install libmxml brew install muparser #Several unit tests fail with NeXus v4.4.2 #https://github.com/mantidproject/mantid/issues/17001 brew install nexusformat --c++11 brew install jsoncpp brew install tbb --c++11 brew install opencascade --build-bottle brew install qwt5 brew install qwtplot3d brew install google-perftools brew install librdkafka
-
Uninstall homebrew Python that some of the dependencies insist on installing
brew uninstall python
-
Optional: for cmake-gui
brew cask install cmake
-
Now to install the other python package dependencies:
sudo easy_install pip sudo -H pip install sphinx # https://github.com/mantidproject/mantid/issues/13481 sudo -H pip install "ipython[notebook]==3.2.1" # qtconsole only required with ipython 4+ #sudo -H pip install qtconsole sudo -H pip install qtpy sudo -H pip install pygments sudo -H pip install pyzmq sudo -H pip install pycifrw # Version matches Windows/RHEL/Ubuntu (trusty) sudo -H pip install PyYAML==3.10 # Version matches Windows/RHEL/Ubuntu (trusty) sudo -H pip install mock==1.0.1
-
Install the theme for sphinx
sudo pip install sphinx_bootstrap_theme
-
Install other python dependencies
sudo pip install psutil brew install h5py
-
Add Homebrew’s site-packages to your python path.
mkdir -p ~/Library/Python/2.7/lib/python/site-packages echo '/usr/local/lib/python2.7/site-packages' > ~/Library/Python/2.7/lib/python/site-packages/homebrew.pth
-
Now you need to patch a header in your python!
a. If building on the command line with make or ninja.
cd /usr/include/python2.7
or
cd /System/Library/Frameworks/Python.framework/Headers
then
sudo cp pyport.h pyport.h.original
sudo patch pyport.h $MANTIDCHECKOUTROOT/buildconfig/pyport.patch
b. If building with Xcode on OS X Yosemite
cd /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7
then
sudo cp pyport.h pyport.h.original
sudo patch pyport.h $MANTIDCHECKOUTROOT/buildconfig/pyport.patch
Note: If Xcode updates for any reason, the patch will be lost.
-
Now run CMake and select the Xcode generator with the default native compilers.
-
Now open the project in Xcode (doing this from the command line to ensure the PYTHONPATH is correctly picked up by Xcode).
cd /path/to/my/build/dir open Mantid.xcodeproj
- The main problem that can arise is due to python path issues. This usually either arises at the CMake or Run from Xcode steps. It is because the PYTHONPATH is not being picked up.
- If you have upgraded to Mavericks (OS X 10.9) from a previous version of OS X with homebrew already installed then you may encounter some issues related to the fact that the default std lib has changed. The easiest way to avoid this is to remove and then re-install all your formulas.
- You may find that if you build the MantidPlot target then you will get errors when you run, such as Can't start python and Cannot load Curve Fitting Plugins, this is due to the fact that the MantidPlot target does not contain all the dependencies. You are best, if you are unsure of the hierarchy, to just use the ALL_BUILD target and then just switch to the MantidPlot target in order to run.
- NOTE that you might need to run
./MantidPlot.app/Contents/MacOS/MantidPlot
from theBUILD-DIR/bin
(instead ofopen MantidPlot.app
OR./MantidPlot
fromBUILD-DIR/bin/MantidPlot.app/Contents/MacOS/
) to get the library paths correct. Otherwise the issues above might show up (at least on OS X 10.11 El Capitan). - Upgrading HDF5 requires also rebuilding nexusformat, h5py, and ParaView.