Project

General

Profile

Preparing a Mac machine for Bilder » History » Revision 27

Revision 26 (David Alexander, 12/27/2017 03:03 PM) → Revision 27/109 (John Cary, 01/12/2018 05:03 PM)

# Preparing a Mac machine for Bilder # 

 __If all you need is python and sphinx__ (e.g., for builds of documentation), then you need only 

 * XCode with command line tools 
 * Latex installed as noted below 

 and then you can add the arguments,    -W python, and your installed Python and CMake will be used if your path is correct. 


 ## Bilder on Darwin ## 

 Darwin comes with bash, so it is Bilder ready for the most part. 

 ### OS X Versions ### 

 Yosemite's XCode that supports C++ 11 by default. 

 El Capitan's clang compiler supports OpenMP. 

 ## Case insensitive file system ## 

 We have noted and filed bugs for CMake errors on OS X when using the case-sensitive file system. To fix we use the case-insensitive file system. There may be problems with various packages and the case-insensitive file system. 

 ## C and C++ compilers and Xcode command line tools ## 

 Install Xcode. To obtain version 6, visit https://developer.apple.com/xcode/download, then at the bottom third of the page, click on the "Additional Tools" link . Sign in with your Apple ID.   

 ~~~~~~ 
     sudo xcode-select --install 
 ~~~~~~ 


 ## X11 ## 

 X11 should not be needed, but if it is needed: 

 Install [XQuartz X11](http://xquartz.macosforge.org/landing/). 

 Create a symbolic link so that the X11 headers can be found by the compiler: 

 ~~~~~~ 
     sudo ln -s /opt/X11/include/X11 /usr/local/include/X11 
 ~~~~~~ 

 ## HomeBrew ## 

 One must select a non-OSX package manager for some additional packages. The candidates are HomeBrew, MacPorts, and Fink, with the HomeBrew being our recommendation at this time, as it is active, and it has the philosophy of not building extraneous stuff that is already present on OSX, which MacPorts tends to do, thus using up more disk space.    HomeBrew also installs packages in their own subdirs with links to other places in /opt, thus making removal a matter removing a directory and then removing broken links in /opt/homebrew. 

 HomeBrew requires that one not have root privileges.    So we make the directory into which we can write: 

 ~~~~~~ 
     sudo -s 
     mkdir -p /opt/homebrew 
     chgrp -R admin /opt 
     chmod -R 775 /opt 
     chmod -R 2775 /opt/homebrew 
     exit 
 ~~~~~~ 

 and then we work as nonroot: 

 ~~~~~~ 
     cd /opt 
     curl -L https://github.com/Homebrew/brew/tarball/master | tar xz --strip 1 -C homebrew 
     chmod -R a+rX /opt/homebrew 
     find /opt/homebrew -type l -exec chmod -h a+r '{}' \; 
 ~~~~~~ 

 and finally as root to pick up the paths by default: 

 ~~~~~~ 
     sudo -s 
     echo "/opt/homebrew/bin" > /etc/paths.d/homebrew 
     echo "/opt/homebrew/share/man" > /etc/manpaths.d/homebrew 
     chmod a+r /etc/paths.d/homebrew /etc/manpaths.d/homebrew 
     exit 
 ~~~~~~ 

 Get the required packages... 

 ~~~~~~ 
     brew install gnupg libpng freetype gd ghostscript 
 ~~~~~~ 

 Nice to have: 

 ~~~~~~ 
     brew install imagemagick 
 ~~~~~~ 

 For Qt5: 

 ~~~~~~ 
     brew install bison flex gperf libcapn 
 ~~~~~~ 

 If you receive a error regarding ruby version: 

 ~~~~~~ 
     brew install ruby@2.3 
 ~~~~~~ 

 If permissions end up wrong, the commands 

 ~~~~~~ 
     chmod -R a+rX /opt/homebrew 
     find /opt/homebrew -type l -exec chmod -h a+r '{}' \; 
 ~~~~~~ 

 may help. 

 To get fortran and a more recent version of the gcc compiler 

 ~~~~~~ 
     brew install gcc49 --with-fortran 
 ~~~~~~ 
    
 __NOT REQUIRED:__ If your computer is a __Jenkins Slave Only__, then you will need svn 1.7 (__skip otherwise__) 

 If your Jenkins is set to use svn 1.7 (which means you'd need your local svn client to be 1.7 as well), then you can upgrade via HomeBrew as follows: 

 ~~~~~~ 
     # Only for Jenkins Slave!! 
     brew install subversion17 
 ~~~~~~ 

 In the process of building svn 1.7, you may find that subversion fails to build because scons is not installed properly. If that's the case, go to /opt/homebrew/opt/scons/bin and do the following: 

 ~~~~~~ 
     # Only for Jenkins Slave and SVN fails to build!! 
     brew update 
     brew doctor 
     brew install subversion17 
 ~~~~~~ 

 ## gfortran ## 

 ### *Recommended Option:* HomeBrew ### 

 Install gcc with HomeBrew as detailed above, using the --with-fortran option to the gcc install. If you have done that, then you can skip this section. 

 As of this writing, Bilder will look for gfortran-4.9 as a backup to gfortran. 

 ### Option 2: HPC ### 

 Install gfortran from [SourceForge HPC](http://hpc.sourceforge.net).    (Do not also install the other gcc compilers.) 

 As of March 29, 2015, the version is 4.9.0. 

 Install via 

 ~~~~~~ 
     $ tar xzf gfortran-4.9-bin.tar.gz -C / 
 ~~~~~~ 

 ### Option 3: GNU ### 

 Install gfortran using the installer from <http://gcc.gnu.org/wiki/GFortranBinaries>. 

 As of March 29, 2015, the version is 4.9.0. 

 The binaries will end up being installed in /usr/local/bin 

 ## LaTeX ## 

 Those with sufficient hard drive space (3.4GB after install) may wish to download the full MacTeX package from <http://www.tug.org/mactex/downloading.html>. After installing, one can see the 'README ME FIRST.pdf' in /Applications/Tex. You will likely need to add /usr/texbin to your path: 

 ~~~~~~ 
     setenv PATH /usr/texbin:${PATH}    # For tcsh 
     export PATH=/usr/texbin:${PATH}    # For bash 
 ~~~~~~ 

 For those who like GUIs, the !TeXworks in /Applications/TeX/TeXworks should work fine. 

 For those with limited space, install BasicTeX from <https://tug.org/mactex/morepackages.html>. Add to your PATH: 

 ~~~~~~ 
     /usr/local/texlive/2016/bin/universal-darwin/ 
 ~~~~~~ 

 and run 

 ~~~~~~ 
     sudo tlmgr update --self 
     sudo tlmgr install breakurl capt-of cmap comment courier ec eepic environ epstopdf eqparbox 
     sudo tlmgr install fancybox fancyvrb footnote fncychap framed gensymb helvetic latexmk lineno 
     sudo tlmgr install mdwtools mmap mptopdf multirow newfloat overpic palatino parskip pdftex pifont 
     sudo tlmgr install revtex4 siunitx subfiles symbol tabulary threeparttable titlesec trimspaces txfonts 
     sudo tlmgr install units upquote url wrapfig xcite xcolor xypic zapfding 
 ~~~~~~ 

 and then used the autoupdate feature to get any additionally needed packages. Gives a 230 M installation. (As opposed to the usual 2GB installation.) 

 You many also need 

 ~~~~~~ 
     sudo chmod -R a+rX /usr/local/texlive/2016basic/texmf-dist/{tex,fonts} 
 ~~~~~~ 

 as it seems that tlmgr does not get the permissions correct. 

 ## Disable spindump ## 

 for faster compilations via 

 ~~~~~~ 
     sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.spindump.plist 
 ~~~~~~ 


 ## Git ## 

 If any repository package requires Git protocol, then for Lion and earlier you may need Git from <http://git-scm.com/download/mac> and add /usr/local/git/bin to your path. 

 ## Java ## 

 You will need to install java by invoking the executable in any way such as... 

 ~~~~~~ 
 java -version 
 ~~~~~~ 

 Follow the instructions in the dialog that takes you to the Oracle website and choose the latest version to download.    (as of Nov 2015 this is 1.8) 

 ## HostName ## 

 For bilder to properly send emails the fully qualified hostname must set on the machine. To check this try... 

 ~~~~~~ 
      hostname -f 
 ~~~~~~ 

 this should return machinename.domainname.com rather than just machinename.    If it does not, then set the hostname of the machine by typing the following commands. 

 ~~~~~~ 
      sudo scutil --set ComputerName "machinename" 
      sudo scutil --set LocalHostName "machinename" 
      sudo scutil --set HostName "machinename.domainname.com" 
      dscacheutil -flushcache 
 ~~~~~~ 

 Restart your Mac after this. 

 ## Power Saving Modes ## 

 For build machines that are not personal machines, disabling certain options will help in connectivity and responsiveness: 

 ~~~~~~ 
 Under Spotlight 
  - disabled the main HD. (multiple mdworkers taking up a lot of cpu.) 
 ~~~~~~ 

 ~~~~~~ 
 Under Energy Saver 
  - Computer sleep: Set to never 
  - Unchecked Put hard disks to sleep when possible 
  - Unchecked Wake for network access 
 ~~~~~~ 



 &nbsp; 
 &nbsp; 
 &nbsp; 
 &nbsp; 
 &nbsp; 
 &nbsp; 
 &nbsp; 
 &nbsp; 
 &nbsp; 
 &nbsp; 

 --- 

 --- 


 # DEPRECATED INSTRUCTIONS # 


 ### Macports ###  

 This provides wget, freetype, and other utilities. Get macports from <http://www.macports.org/install.php> and install. 

 Note: Before proceeding with the installation of various macports packages noted below on Lion machines with Xcode 4.3, one needs to run 

 ~~~~~~ 
     sudo xcode-select -switch /Applications/Xcode.app 
 ~~~~~~ 

 Otherwise, there will be an error installing zlib during the wget installation below. 

 After the macports installation, do 

 ~~~~~~ 
     sudo port install wget 
     sudo port install ImageMagick +no_x11 
     sudo port install f2c 
 ~~~~~~ 


 ### XCode ### 
 ### Lion ### 

 On Lion, the command line compilers are not installed automatically. After installing Xcode, navigate to the  
 Preferences->Download dialog  
 and install the Command Line Tools. The dialog is..  

 !screenShotCommandLineTools.png! 

 or from the command line do 

 ~~~~~~ 
     sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer/ 
     xcodebuild 
       (hit agree) 
 ~~~~~~ 

 You may subsequently need to build your first package with sudo in order to accept the Xcode licenses. 

 ### Mountain Lion ###  

 Same as Mavericks? 

 ### Mavericks ### 

 ~~~~~~ 
     sudo xcode-select --install 
 ~~~~~~ 


 ## Java ## 

 (The below does not apply to yosemite.) 

 The cmake build may fail due to missing java headers linked to in /System/Library/Frameworks/JavaVM.framework/Headers. To fix: 

 ~~~~~~ 
     cd /System/Library/Frameworks/JavaVM.framework/Headers 
     sudo mv jni.h jni.h.missing 
 ~~~~~~ 


 ## Moving aside the system MPI (Snow Leopard and earlier) ## 

 The system MPI can interfere with the Bilder built MPI, so we recommend moving aside the system MPI: 

 ~~~~~~ 
     cd /usr/lib 
     mkdir openmpi-save 
     mv libopen-* libmpi* openmpi-save 
     cd /usr/bin 
     mkdir openmpi-save 
     mv mpi* openmpi-save 
 ~~~~~~