Project

General

Profile

Preparing a Mac machine for Bilder » History » Version 16

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