Project

General

Profile

Preparing a Mac machine for Bilder » History » Version 15

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