Project

General

Profile

Preparing a Mac machine for Bilder » History » Version 28

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