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