Project

General

Profile

Preparing a Mac machine for Bilder » History » Version 24

John Cary, 05/05/2017 06:39 AM

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