Project

General

Profile

Preparing a Mac machine for Bilder » History » Version 18

David Alexander, 02/17/2017 02:33 PM

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 16 John Cary
    brew install libpng freetype gd hg 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
~~~~~~
96 14 John Cary
    brew tap homebrew/versions
97
    brew install gcc49 --with-fortran
98 1 Redmine Admin
~~~~~~
99
    
100
__NOT REQUIRED:__ If your computer is a __Jenkins Slave Only__, then you will need svn 1.7 (__skip otherwise__)
101
102
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:
103
104
~~~~~~
105
    # Only for Jenkins Slave!!
106 14 John Cary
    brew install subversion17
107 1 Redmine Admin
~~~~~~
108
109 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:
110 1 Redmine Admin
111
~~~~~~
112
    # Only for Jenkins Slave and SVN fails to build!!
113 8 Redmine Admin
    brew update
114 1 Redmine Admin
    brew doctor
115 11 Redmine Admin
    brew install subversion17
116 8 Redmine Admin
~~~~~~
117 11 Redmine Admin
118 1 Redmine Admin
## gfortran ##
119 12 Redmine Admin
120 1 Redmine Admin
### *Recommended Option:* HomeBrew ###
121 11 Redmine Admin
122 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.
123 11 Redmine Admin
124 1 Redmine Admin
As of this writing, Bilder will look for gfortran-4.9 as a backup to gfortran.
125 11 Redmine Admin
126 1 Redmine Admin
### Option 2: HPC ###
127 11 Redmine Admin
128 1 Redmine Admin
Install gfortran from [SourceForge HPC](http://hpc.sourceforge.net).  (Do not also install the other gcc compilers.)
129 11 Redmine Admin
130 1 Redmine Admin
As of March 29, 2015, the version is 4.9.0.
131
132 11 Redmine Admin
Install via
133 1 Redmine Admin
134
~~~~~~
135 11 Redmine Admin
    $ tar xzf gfortran-4.9-bin.tar.gz -C /
136 1 Redmine Admin
~~~~~~
137 11 Redmine Admin
138
### Option 3: GNU ###
139
140
Install gfortran using the installer from <http://gcc.gnu.org/wiki/GFortranBinaries>.
141
142
As of March 29, 2015, the version is 4.9.0.
143
144
The binaries will end up being installed in /usr/local/bin
145 1 Redmine Admin
146
## LaTeX ##
147
148
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:
149
150
~~~~~~
151
    setenv PATH /usr/texbin:${PATH}  # For tcsh
152 13 Redmine Admin
    export PATH=/usr/texbin:${PATH}  # For bash
153 1 Redmine Admin
~~~~~~
154 13 Redmine Admin
155 1 Redmine Admin
For those who like GUIs, the !TeXworks in /Applications/TeX/TeXworks should work fine.
156
157 13 Redmine Admin
For those with limited space, install BasicTeX from <https://tug.org/mactex/morepackages.html>. Add to your PATH:
158
159
~~~~~~
160 16 John Cary
    /usr/local/texlive/2016/bin/universal-darwin/
161 13 Redmine Admin
~~~~~~
162
163 1 Redmine Admin
and run
164
165
~~~~~~
166
    sudo tlmgr update --self
167 17 John Cary
    for i in breakurl capt-of cmap comment courier ec eepic environ epstopdf eqparbox fancybox \
168
fancyvrb framed footnote framed fricychap gensymb helvetic lineno mdwtools mmap mptopdf multirow \
169
newfloat overpic palatino parskip pdftex pifont revtex4 siunitx subfiles symbol tabulary \
170
threeparttable titlesec trimspaces txfonts units upquote url wrapfig xcite xcolor xypic zapfding; do
171 1 Redmine Admin
      sudo tlmgr install $i
172
    done
173
~~~~~~
174 13 Redmine Admin
175 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.)
176
177
You many also need
178
179
~~~~~~
180 16 John Cary
    sudo chmod -R a+rX /usr/local/texlive/2016/basic/texmf-dist/{tex,fonts}
181 1 Redmine Admin
~~~~~~
182
183
as it seems that tlmgr does not get the permissions correct.
184
185
## Disable spindump ##
186
187
for faster compilations via
188
189
~~~~~~
190
    sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.spindump.plist
191
~~~~~~
192
193 2 Redmine Admin
194 1 Redmine Admin
## Git ##
195 11 Redmine Admin
196 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.
197 11 Redmine Admin
198
## Java ##
199
200
You will need to install java by invoking the executable in any way such as...
201
202
~~~~~~
203
java -version
204
~~~~~~
205 1 Redmine Admin
206
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)
207
208
## HostName ##
209
210 2 Redmine Admin
For bilder to properly send emails the fully qualified hostname must set on the machine. To check this try...
211 1 Redmine Admin
212
~~~~~~
213
     hostname -f
214
~~~~~~
215
216
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.
217
218
~~~~~~
219
     sudo scutil --set ComputerName "newname"
220
     sudo scutil --set LocalHostName "newname"
221
     sudo scutil --set HostName "newname"
222
     dscacheutil -flushcache
223
~~~~~~
224
225
Restart your Mac after this.
226
227
## Power Saving Modes ##
228
229
For build machines that are not personal machines, disabling certain options will help in connectivity and responsiveness:
230
231
~~~~~~
232 2 Redmine Admin
Under Spotlight
233 1 Redmine Admin
 - disabled the main HD. (multiple mdworkers taking up a lot of cpu.)
234
~~~~~~
235
236
~~~~~~
237
Under Energy Saver
238
 - Computer sleep: Set to never
239
 - Unchecked Put hard disks to sleep when possible
240 11 Redmine Admin
 - Unchecked Wake for network access
241
~~~~~~
242 1 Redmine Admin
243
244
245
&nbsp;
246
&nbsp;
247
&nbsp;
248
&nbsp;
249 9 Redmine Admin
&nbsp;
250
&nbsp;
251
&nbsp;
252
&nbsp;
253 11 Redmine Admin
&nbsp;
254 9 Redmine Admin
&nbsp;
255 11 Redmine Admin
256 9 Redmine Admin
---
257 11 Redmine Admin
258
---
259
260
261
# DEPRECATED INSTRUCTIONS #
262
263 1 Redmine Admin
264 10 Redmine Admin
### Macports ### 
265
266
This provides wget, freetype, and other utilities. Get macports from <http://www.macports.org/install.php> and install.
267 11 Redmine Admin
268
Note: Before proceeding with the installation of various macports packages noted below on Lion machines with Xcode 4.3, one needs to run
269
270 10 Redmine Admin
~~~~~~
271
    sudo xcode-select -switch /Applications/Xcode.app
272
~~~~~~
273
274
Otherwise, there will be an error installing zlib during the wget installation below.
275 11 Redmine Admin
276
After the macports installation, do
277
278
~~~~~~
279
    sudo port install wget
280 10 Redmine Admin
    sudo port install ImageMagick +no_x11
281
    sudo port install f2c
282
~~~~~~
283 2 Redmine Admin
284
285 1 Redmine Admin
### XCode ###
286
### Lion ###
287
288
On Lion, the command line compilers are not installed automatically. After installing Xcode, navigate to the 
289
Preferences->Download dialog 
290
and install the Command Line Tools. The dialog is.. 
291
292
!screenShotCommandLineTools.png!
293
294
or from the command line do
295
296
~~~~~~
297
    sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer/
298
    xcodebuild
299
      (hit agree)
300
~~~~~~
301 11 Redmine Admin
302 1 Redmine Admin
You may subsequently need to build your first package with sudo in order to accept the Xcode licenses.
303
304
### Mountain Lion ### 
305 2 Redmine Admin
306 1 Redmine Admin
Same as Mavericks?
307
308
### Mavericks ###
309
310 11 Redmine Admin
~~~~~~
311 1 Redmine Admin
    sudo xcode-select --install
312 2 Redmine Admin
~~~~~~
313 1 Redmine Admin
314
315
## Java ##
316
317
(The below does not apply to yosemite.)
318
319
The cmake build may fail due to missing java headers linked to in /System/Library/Frameworks/JavaVM.framework/Headers. To fix:
320
321
~~~~~~
322
    cd /System/Library/Frameworks/JavaVM.framework/Headers
323
    sudo mv jni.h jni.h.missing
324 2 Redmine Admin
~~~~~~
325 1 Redmine Admin
326
327
## Moving aside the system MPI (Snow Leopard and earlier) ##
328
329
The system MPI can interfere with the Bilder built MPI, so we recommend moving aside the system MPI:
330
331
~~~~~~
332
    cd /usr/lib
333
    mkdir openmpi-save
334
    mv libopen-* libmpi* openmpi-save
335
    cd /usr/bin
336
    mkdir openmpi-save
337
    mv mpi* openmpi-save
338
~~~~~~