Project

General

Profile

Preparing a Mac machine for Bilder » History » Version 8

Redmine Admin, 11/23/2015 03:28 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 3 Redmine Admin
It is recommended to have Yosemite as this OS 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 2 Redmine Admin
## Case insensitive file system ##
10 1 Redmine Admin
11
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.
12
13
14 2 Redmine Admin
## C and C++ compilers and Xcode command line tools ##
15 1 Redmine Admin
16
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.  
17
18
~~~~~~
19
    sudo xcode-select --install
20
~~~~~~
21
22 2 Redmine Admin
## gfortran ##
23 1 Redmine Admin
24
25
26 4 Redmine Admin
### Redommended Option: Homebrew###
27
28
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. 
29 1 Redmine Admin
30
As of this writing, Bilder will look for gfortran-4.9 as a backup to gfortran.
31
32 2 Redmine Admin
### HPC gfortran ###
33 1 Redmine Admin
34
Install gfortran from [SourceForge HPC](http://hpc.sourceforge.net).  (Do not also install the other gcc compilers.)
35
36
As of March 29, 2015, the version is 4.9.0.
37
38
Install via
39
40
~~~~~~
41
    $ tar xzf gfortran-4.9-bin.tar.gz -C /
42
~~~~~~
43
44 2 Redmine Admin
### GNU Binaries ###
45 1 Redmine Admin
46
Install gfortran using the installer from <http://gcc.gnu.org/wiki/GFortranBinaries>.
47
48
As of March 29, 2015, the version is 4.9.0.
49
50 6 Redmine Admin
The binaries will end up being installed in /usr/local/bin.
51 1 Redmine Admin
52 2 Redmine Admin
## X11 ##
53 1 Redmine Admin
54
Install [XQuartz X11](http://xquartz.macosforge.org/landing/).
55
56
Create a symbolic link so that the X11 headers can be found by the compiler:
57
58
~~~~~~
59
    sudo ln -s /opt/X11/include/X11 /usr/local/include/X11
60
~~~~~~
61
62 8 Redmine Admin
## HomeBrew ##
63 1 Redmine Admin
64 8 Redmine Admin
One must select a non-OSX package manager for some additional packages. 
65 1 Redmine Admin
66 8 Redmine Admin
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 pf removing a directory and then removing broken links in /opt/homebrew.
67 1 Redmine Admin
68 8 Redmine Admin
69 2 Redmine Admin
### HomeBrew ###
70 1 Redmine Admin
71
We follow the installation methodology of http://ascarter.net/2010/02/22/homebrew-for-os-x.html, in which
72
brew must be run by root and all files are owned by root.  Since sudo is then used, you may want the lines,
73
74
~~~~~~
75
    Defaults umask = 0002
76
    Defaults umask_override
77
~~~~~~
78
79
in /etc/sudoers (done with visudo). 
80
81
You may also want to check to make sure you do not have HomeBrew already installed with 'which brew' or checking in /usr/local/bin for a brew executable.  If you do have a copy installed, you might consider uninstalling it (see https://gist.github.com/mxcl/1173223 if installed in /usr/local) and starting a fresh install.
82
83 2 Redmine Admin
### Get HomeBrew and add it to your path ###
84 1 Redmine Admin
85
~~~~~~
86
    sudo -s
87
    mkdir -p /opt/homebrew
88
    chgrp -R admin /opt
89
    chmod -R 775 /opt
90
    chmod -R 2775 /opt/homebrew
91
    cd /opt
92
    curl -L http://github.com/mxcl/homebrew/tarball/master | tar xz --strip 1 -C homebrew
93
    chmod -R a+rX /opt/homebrew
94
    find /opt/homebrew -type l -exec chmod -h a+r '{}' \;
95
    echo "/opt/homebrew/bin" > /etc/paths.d/homebrew
96
    echo "/opt/homebrew/share/man" > /etc/manpaths.d/homebrew
97
    chmod a+r /etc/paths.d/homebrew /etc/manpaths.d/homebrew
98
    exit
99
~~~~~~
100
101 8 Redmine Admin
### Get the required packages ###
102 1 Redmine Admin
103
Required packages...
104
105
~~~~~~
106
    sudo -s
107
    brew install libpng freetype gd
108
    brew install wget hg ghostscript
109
    exit
110
~~~~~~
111
112
Optional packages such as imagemagick can be installed the same way.
113
114
If permissions end up wrong, the commands
115
116
~~~~~~
117
    sudo chmod -R a+rX /opt/homebrew
118
    sudo find /opt/homebrew -type l -exec chmod -h a+r '{}' \;
119
~~~~~~
120
121
may help.
122
123
To get a more recent version of the gcc compiler
124
125
~~~~~~
126
    sudo brew tap homebrew/versions
127
    sudo brew install gcc49 --with-fortran
128
~~~~~~
129
130 8 Redmine Admin
__NOT REQUIRED:__  If your computer is a __Jenkins Slave Only__, then you will need svn 1.7.  (__skip otherwise__)
131 2 Redmine Admin
132 1 Redmine Admin
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:
133
134
~~~~~~
135 8 Redmine Admin
    # Only for Jenkins Slave!!
136 1 Redmine Admin
    sudo brew install subversion17
137
~~~~~~
138
139
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:
140
141
~~~~~~
142 8 Redmine Admin
    # Only for Jenkins Slave and SVN fails to build!! 
143 1 Redmine Admin
    brew update
144
    brew doctor
145
    brew install subversion17
146
~~~~~~
147
148
149
150 2 Redmine Admin
### Macports ###
151 1 Redmine Admin
152
This provides wget, freetype, and other utilities. Get macports from <http://www.macports.org/install.php> and install.
153
154
Note: Before proceeding with the installation of various macports packages noted below on Lion machines with Xcode 4.3, one needs to run
155
156
~~~~~~
157
    sudo xcode-select -switch /Applications/Xcode.app
158
~~~~~~
159
160
Otherwise, there will be an error installing zlib during the wget installation below.
161
162
After the macports installation, do
163
164
~~~~~~
165
    sudo port install wget
166
    sudo port install ImageMagick +no_x11
167
    sudo port install f2c
168
~~~~~~
169
170 2 Redmine Admin
## Latex ##
171 1 Redmine Admin
172
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:
173
174
~~~~~~
175
    setenv PATH /usr/texbin:${PATH}  # For tcsh
176
    export PATH=/usr/texbin:${PATH}  # For bash
177
~~~~~~
178
179
For those who like GUIs, the TexWorks? in /Applications/Tex/TeXworks should work fine.
180
181
For those with limited space, install BasicTeX from <https://tug.org/mactex/morepackages.html>. Add /usr/local/texlive/2014basic/bin/universal-darwin/ to your path, run
182
183
~~~~~~
184
    sudo tlmgr update --self
185
    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
186
      sudo tlmgr install $i
187
    done
188
~~~~~~
189
190
and then used the autoupdate feature to get any additionally needed packages. Gives a 230 M installation. (As opposed to the usual 2GB installation.)
191
192
You many need also to do
193
194
~~~~~~
195
    sudo chmod -R a+rX /usr/local/texlive/2014basic/texmf-dist/{tex,fonts}
196
~~~~~~
197
198
as it seems that tlmgr does not get the permissions correct.
199
200
201
202 2 Redmine Admin
## Disable spindump ##
203 1 Redmine Admin
204
for faster compilations via
205
206
~~~~~~
207
    sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.spindump.plist
208
~~~~~~
209
210
211 2 Redmine Admin
## Git ##
212 1 Redmine Admin
213
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.
214
215
216 2 Redmine Admin
## HostName ##
217 1 Redmine Admin
218
For bilder to properly send emails the fully qualified hostname must set on the machine. To check this try...
219
220
~~~~~~
221
     hostname -f
222
~~~~~~
223
224
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.
225
226
~~~~~~
227
     sudo scutil --set ComputerName "newname"
228
     sudo scutil --set LocalHostName "newname"
229
     sudo scutil --set HostName "newname"
230
     dscacheutil -flushcache
231
~~~~~~
232
233
Restart your Mac after this.
234
235 2 Redmine Admin
## Power Saving Modes ##
236 1 Redmine Admin
237
For build machines that are not personal machines, disabling certain options will help in connectivity and responsiveness:
238
239
~~~~~~
240
Under Spotlight
241
 - disabled the main HD. (multiple mdworkers taking up a lot of cpu.)
242
~~~~~~
243
244
~~~~~~
245
Under Energy Saver
246
 - Computer sleep: Set to never
247
 - Unchecked Put hard disks to sleep when possible
248
 - Unchecked Wake for network access
249
~~~~~~
250
251
252 2 Redmine Admin
## Deprecated instructions for older OS ##
253 1 Redmine Admin
254 2 Redmine Admin
### XCode ###
255
### Lion ###
256 1 Redmine Admin
257
On Lion, the command line compilers are not installed automatically. After installing Xcode, navigate to the 
258
Preferences->Download dialog 
259
and install the Command Line Tools. The dialog is.. 
260
261
!screenShotCommandLineTools.png!
262
263
or from the command line do
264
265
~~~~~~
266
    sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer/
267
    xcodebuild
268
      (hit agree)
269
~~~~~~
270
271
You may subsequently need to build your first package with sudo in order to accept the Xcode licenses.
272
273 2 Redmine Admin
### Mountain Lion ###
274 1 Redmine Admin
275
Same as Mavericks?
276
277 2 Redmine Admin
### Mavericks ###
278 1 Redmine Admin
279
~~~~~~
280
    sudo xcode-select --install
281
~~~~~~
282
283
284 2 Redmine Admin
## Java ##
285 1 Redmine Admin
286
(The below does not apply to yosemite.)
287
288
The cmake build may fail due to missing java headers linked to in /System/Library/Frameworks/JavaVM.framework/Headers. To fix:
289
290
~~~~~~
291
    cd /System/Library/Frameworks/JavaVM.framework/Headers
292
    sudo mv jni.h jni.h.missing
293
~~~~~~
294
295
296 2 Redmine Admin
## Moving aside the system MPI (Snow Leopard and earlier) ##
297 1 Redmine Admin
298
The system MPI can interfere with the Bilder built MPI, so we recommend moving aside the system MPI:
299
300
~~~~~~
301
    cd /usr/lib
302
    mkdir openmpi-save
303
    mv libopen-* libmpi* openmpi-save
304
    cd /usr/bin
305
    mkdir openmpi-save
306
    mv mpi* openmpi-save
307
~~~~~~