Project

General

Profile

Preparing a Mac machine for Bilder » History » Version 20

John Cary, 02/23/2017 07:27 AM

1 2 Redmine Admin
# Preparing a Mac machine for Bilder #
2 1 Redmine Admin
3 2 Redmine Admin
## Bilder on Darwin ##
4 1 Redmine Admin
5 16 John Cary
Darwin comes with bash, so it is Bilder ready for the most part.
6 1 Redmine Admin
7 16 John Cary
### OS X Versions ###
8 1 Redmine Admin
9 16 John Cary
Yosemite's XCode that supports C++ 11 by default.
10 1 Redmine Admin
11 16 John Cary
El Capitan's clang compiler supports OpenMP.
12
13 1 Redmine Admin
## Case insensitive file system ##
14
15
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.
16
17 2 Redmine Admin
## C and C++ compilers and Xcode command line tools ##
18 1 Redmine Admin
19
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.  
20
21
~~~~~~
22 2 Redmine Admin
    sudo xcode-select --install
23 1 Redmine Admin
~~~~~~
24
25
26 6 Redmine Admin
## X11 ##
27 1 Redmine Admin
28 14 John Cary
X11 should not be needed, but if it is needed:
29
30 2 Redmine Admin
Install [XQuartz X11](http://xquartz.macosforge.org/landing/).
31 1 Redmine Admin
32
Create a symbolic link so that the X11 headers can be found by the compiler:
33
34
~~~~~~
35
    sudo ln -s /opt/X11/include/X11 /usr/local/include/X11
36
~~~~~~
37
38
## HomeBrew ##
39
40
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.
41
42 14 John Cary
HomeBrew requires that one not have root privileges.  So we make the directory into which we can write:
43 1 Redmine Admin
44
~~~~~~
45
    sudo -s
46
    mkdir -p /opt/homebrew
47
    chgrp -R admin /opt
48
    chmod -R 775 /opt
49
    chmod -R 2775 /opt/homebrew
50 14 John Cary
    exit
51
~~~~~~
52
53
and then we work as nonroot:
54
55
~~~~~~
56 1 Redmine Admin
    cd /opt
57 14 John Cary
    curl -L https://github.com/Homebrew/brew/tarball/master | tar xz --strip 1 -C homebrew
58 1 Redmine Admin
    chmod -R a+rX /opt/homebrew
59 15 John Cary
    find /opt/homebrew -type l -exec chmod -h a+r '{}' \;
60 14 John Cary
~~~~~~
61 1 Redmine Admin
62 15 John Cary
and finally as root to pick up the paths by default:
63 14 John Cary
64 1 Redmine Admin
~~~~~~
65 18 David Alexander
    sudo -s
66
    echo "/opt/homebrew/bin" > /etc/paths.d/homebrew
67
    echo "/opt/homebrew/share/man" > /etc/manpaths.d/homebrew
68
    chmod a+r /etc/paths.d/homebrew /etc/manpaths.d/homebrew
69
    exit
70 1 Redmine Admin
~~~~~~
71
72
Get the required packages...
73
74
~~~~~~
75 19 John Cary
    brew install libpng freetype gd ghostscript
76 1 Redmine Admin
~~~~~~
77
78 16 John Cary
Nice to have:
79 1 Redmine Admin
80 16 John Cary
~~~~~~
81
    brew install imagemagick
82
~~~~~~
83
84 1 Redmine Admin
If permissions end up wrong, the commands
85
86
~~~~~~
87 14 John Cary
    chmod -R a+rX /opt/homebrew
88
    find /opt/homebrew -type l -exec chmod -h a+r '{}' \;
89 1 Redmine Admin
~~~~~~
90
91
may help.
92
93 16 John Cary
To get fortran and a more recent version of the gcc compiler
94 1 Redmine Admin
95 14 John Cary
~~~~~~
96
    brew install gcc49 --with-fortran
97 1 Redmine Admin
~~~~~~
98
    
99
__NOT REQUIRED:__ If your computer is a __Jenkins Slave Only__, then you will need svn 1.7 (__skip otherwise__)
100
101
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:
102
103
~~~~~~
104
    # Only for Jenkins Slave!!
105 14 John Cary
    brew install subversion17
106 1 Redmine Admin
~~~~~~
107
108 11 Redmine Admin
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:
109 1 Redmine Admin
110
~~~~~~
111
    # Only for Jenkins Slave and SVN fails to build!!
112 8 Redmine Admin
    brew update
113 1 Redmine Admin
    brew doctor
114 11 Redmine Admin
    brew install subversion17
115 8 Redmine Admin
~~~~~~
116 11 Redmine Admin
117 1 Redmine Admin
## gfortran ##
118 12 Redmine Admin
119 1 Redmine Admin
### *Recommended Option:* HomeBrew ###
120 11 Redmine Admin
121 1 Redmine Admin
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.
122 11 Redmine Admin
123 1 Redmine Admin
As of this writing, Bilder will look for gfortran-4.9 as a backup to gfortran.
124 11 Redmine Admin
125 1 Redmine Admin
### Option 2: HPC ###
126 11 Redmine Admin
127 1 Redmine Admin
Install gfortran from [SourceForge HPC](http://hpc.sourceforge.net).  (Do not also install the other gcc compilers.)
128 11 Redmine Admin
129 1 Redmine Admin
As of March 29, 2015, the version is 4.9.0.
130
131 11 Redmine Admin
Install via
132 1 Redmine Admin
133
~~~~~~
134 11 Redmine Admin
    $ tar xzf gfortran-4.9-bin.tar.gz -C /
135 1 Redmine Admin
~~~~~~
136 11 Redmine Admin
137
### Option 3: GNU ###
138
139
Install gfortran using the installer from <http://gcc.gnu.org/wiki/GFortranBinaries>.
140
141
As of March 29, 2015, the version is 4.9.0.
142
143
The binaries will end up being installed in /usr/local/bin
144 1 Redmine Admin
145
## LaTeX ##
146
147
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:
148
149
~~~~~~
150
    setenv PATH /usr/texbin:${PATH}  # For tcsh
151 13 Redmine Admin
    export PATH=/usr/texbin:${PATH}  # For bash
152 1 Redmine Admin
~~~~~~
153 13 Redmine Admin
154 1 Redmine Admin
For those who like GUIs, the !TeXworks in /Applications/TeX/TeXworks should work fine.
155
156 13 Redmine Admin
For those with limited space, install BasicTeX from <https://tug.org/mactex/morepackages.html>. Add to your PATH:
157
158
~~~~~~
159 16 John Cary
    /usr/local/texlive/2016/bin/universal-darwin/
160 13 Redmine Admin
~~~~~~
161
162 1 Redmine Admin
and run
163
164
~~~~~~
165
    sudo tlmgr update --self
166 17 John Cary
    for i in breakurl capt-of cmap comment courier ec eepic environ epstopdf eqparbox fancybox \
167 20 John Cary
fancyvrb framed footnote framed fncychap gensymb helvetic lineno mdwtools mmap mptopdf multirow \
168 17 John Cary
newfloat overpic palatino parskip pdftex pifont revtex4 siunitx subfiles symbol tabulary \
169
threeparttable titlesec trimspaces txfonts units upquote url wrapfig xcite xcolor xypic zapfding; do
170 1 Redmine Admin
      sudo tlmgr install $i
171
    done
172
~~~~~~
173 13 Redmine Admin
174 1 Redmine Admin
and then used the autoupdate feature to get any additionally needed packages. Gives a 230 M installation. (As opposed to the usual 2GB installation.)
175
176
You many also need
177
178
~~~~~~
179 16 John Cary
    sudo chmod -R a+rX /usr/local/texlive/2016/basic/texmf-dist/{tex,fonts}
180 1 Redmine Admin
~~~~~~
181
182
as it seems that tlmgr does not get the permissions correct.
183
184
## Disable spindump ##
185
186
for faster compilations via
187
188
~~~~~~
189
    sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.spindump.plist
190
~~~~~~
191
192 2 Redmine Admin
193 1 Redmine Admin
## Git ##
194 11 Redmine Admin
195 1 Redmine Admin
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.
196 11 Redmine Admin
197
## Java ##
198
199
You will need to install java by invoking the executable in any way such as...
200
201
~~~~~~
202
java -version
203
~~~~~~
204 1 Redmine Admin
205
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)
206
207
## HostName ##
208
209 2 Redmine Admin
For bilder to properly send emails the fully qualified hostname must set on the machine. To check this try...
210 1 Redmine Admin
211
~~~~~~
212
     hostname -f
213
~~~~~~
214
215
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.
216
217
~~~~~~
218
     sudo scutil --set ComputerName "newname"
219
     sudo scutil --set LocalHostName "newname"
220
     sudo scutil --set HostName "newname"
221
     dscacheutil -flushcache
222
~~~~~~
223
224
Restart your Mac after this.
225
226
## Power Saving Modes ##
227
228
For build machines that are not personal machines, disabling certain options will help in connectivity and responsiveness:
229
230
~~~~~~
231 2 Redmine Admin
Under Spotlight
232 1 Redmine Admin
 - disabled the main HD. (multiple mdworkers taking up a lot of cpu.)
233
~~~~~~
234
235
~~~~~~
236
Under Energy Saver
237
 - Computer sleep: Set to never
238
 - Unchecked Put hard disks to sleep when possible
239 11 Redmine Admin
 - Unchecked Wake for network access
240
~~~~~~
241 1 Redmine Admin
242
243
244
&nbsp;
245
&nbsp;
246
&nbsp;
247
&nbsp;
248 9 Redmine Admin
&nbsp;
249
&nbsp;
250
&nbsp;
251
&nbsp;
252 11 Redmine Admin
&nbsp;
253 9 Redmine Admin
&nbsp;
254 11 Redmine Admin
255 9 Redmine Admin
---
256 11 Redmine Admin
257
---
258
259
260
# DEPRECATED INSTRUCTIONS #
261
262 1 Redmine Admin
263 10 Redmine Admin
### Macports ### 
264
265
This provides wget, freetype, and other utilities. Get macports from <http://www.macports.org/install.php> and install.
266 11 Redmine Admin
267
Note: Before proceeding with the installation of various macports packages noted below on Lion machines with Xcode 4.3, one needs to run
268
269 10 Redmine Admin
~~~~~~
270
    sudo xcode-select -switch /Applications/Xcode.app
271
~~~~~~
272
273
Otherwise, there will be an error installing zlib during the wget installation below.
274 11 Redmine Admin
275
After the macports installation, do
276
277
~~~~~~
278
    sudo port install wget
279 10 Redmine Admin
    sudo port install ImageMagick +no_x11
280
    sudo port install f2c
281
~~~~~~
282 2 Redmine Admin
283
284 1 Redmine Admin
### XCode ###
285
### Lion ###
286
287
On Lion, the command line compilers are not installed automatically. After installing Xcode, navigate to the 
288
Preferences->Download dialog 
289
and install the Command Line Tools. The dialog is.. 
290
291
!screenShotCommandLineTools.png!
292
293
or from the command line do
294
295
~~~~~~
296
    sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer/
297
    xcodebuild
298
      (hit agree)
299
~~~~~~
300 11 Redmine Admin
301 1 Redmine Admin
You may subsequently need to build your first package with sudo in order to accept the Xcode licenses.
302
303
### Mountain Lion ### 
304 2 Redmine Admin
305 1 Redmine Admin
Same as Mavericks?
306
307
### Mavericks ###
308
309 11 Redmine Admin
~~~~~~
310 1 Redmine Admin
    sudo xcode-select --install
311 2 Redmine Admin
~~~~~~
312 1 Redmine Admin
313
314
## Java ##
315
316
(The below does not apply to yosemite.)
317
318
The cmake build may fail due to missing java headers linked to in /System/Library/Frameworks/JavaVM.framework/Headers. To fix:
319
320
~~~~~~
321
    cd /System/Library/Frameworks/JavaVM.framework/Headers
322
    sudo mv jni.h jni.h.missing
323 2 Redmine Admin
~~~~~~
324 1 Redmine Admin
325
326
## Moving aside the system MPI (Snow Leopard and earlier) ##
327
328
The system MPI can interfere with the Bilder built MPI, so we recommend moving aside the system MPI:
329
330
~~~~~~
331
    cd /usr/lib
332
    mkdir openmpi-save
333
    mv libopen-* libmpi* openmpi-save
334
    cd /usr/bin
335
    mkdir openmpi-save
336
    mv mpi* openmpi-save
337
~~~~~~