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