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