Preparing a Mac machine for Bilder » History » Version 37
Nathan Neri, 01/21/2019 11:41 AM
Fixing formatting.
1 | 2 | Redmine Admin | # Preparing a Mac machine for Bilder # |
---|---|---|---|
2 | 1 | Redmine Admin | |
3 | 24 | John Cary | __If all you need is python and sphinx__ (e.g., for builds of documentation), then you need only |
4 | |||
5 | * XCode with command line tools |
||
6 | * Latex installed as noted below |
||
7 | |||
8 | and then you can add the arguments, -W python, and your installed Python and CMake will be used if your path is correct. |
||
9 | |||
10 | |||
11 | 2 | Redmine Admin | ## Bilder on Darwin ## |
12 | 1 | Redmine Admin | |
13 | 16 | John Cary | Darwin comes with bash, so it is Bilder ready for the most part. |
14 | 1 | Redmine Admin | |
15 | 16 | John Cary | ### OS X Versions ### |
16 | 1 | Redmine Admin | |
17 | 16 | John Cary | Yosemite's XCode that supports C++ 11 by default. |
18 | 1 | Redmine Admin | |
19 | 16 | John Cary | El Capitan's clang compiler supports OpenMP. |
20 | |||
21 | 1 | Redmine Admin | ## Case insensitive file system ## |
22 | |||
23 | 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. |
||
24 | |||
25 | 2 | Redmine Admin | ## C and C++ compilers and Xcode command line tools ## |
26 | 1 | Redmine Admin | |
27 | 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. |
||
28 | |||
29 | ~~~~~~ |
||
30 | 31 | John Cary | sudo xcode-select --install |
31 | 1 | Redmine Admin | ~~~~~~ |
32 | |||
33 | 35 | John Cary | With mojave, one must additionally |
34 | |||
35 | ~~~~~~ |
||
36 | sudo installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target / |
||
37 | ~~~~~~ |
||
38 | |||
39 | But https://apple.stackexchange.com/questions/337940/why-is-usr-include-missing-i-have-xcode-and-command-line-tools-installed-moja says it is better to use `xcrun --show-sdk-path` to figure this out. |
||
40 | |||
41 | 1 | Redmine Admin | ## HomeBrew ## |
42 | |||
43 | 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. |
||
44 | |||
45 | 14 | John Cary | HomeBrew requires that one not have root privileges. So we make the directory into which we can write: |
46 | 1 | Redmine Admin | |
47 | ~~~~~~ |
||
48 | 29 | John Cary | sudo -s |
49 | mkdir -p /opt/homebrew |
||
50 | chgrp -R admin /opt |
||
51 | chmod -R 775 /opt |
||
52 | chmod -R 2775 /opt/homebrew |
||
53 | exit |
||
54 | 14 | John Cary | ~~~~~~ |
55 | |||
56 | and then we work as nonroot: |
||
57 | |||
58 | ~~~~~~ |
||
59 | 29 | John Cary | cd /opt |
60 | curl -L https://github.com/Homebrew/brew/tarball/master | tar xz --strip 1 -C homebrew |
||
61 | chmod -R a+rX /opt/homebrew |
||
62 | find /opt/homebrew -type l -exec chmod -h a+r '{}' \; |
||
63 | 14 | John Cary | ~~~~~~ |
64 | 1 | Redmine Admin | |
65 | 15 | John Cary | and finally as root to pick up the paths by default: |
66 | 14 | John Cary | |
67 | 1 | Redmine Admin | ~~~~~~ |
68 | 29 | John Cary | sudo -s |
69 | echo "/opt/homebrew/bin" > /etc/paths.d/homebrew |
||
70 | echo "/opt/homebrew/share/man" > /etc/manpaths.d/homebrew |
||
71 | chmod a+r /etc/paths.d/homebrew /etc/manpaths.d/homebrew |
||
72 | exit |
||
73 | 1 | Redmine Admin | ~~~~~~ |
74 | |||
75 | Get the required packages... |
||
76 | |||
77 | ~~~~~~ |
||
78 | 29 | John Cary | brew install gnupg libpng freetype gd ghostscript |
79 | 1 | Redmine Admin | ~~~~~~ |
80 | |||
81 | 16 | John Cary | Nice to have: |
82 | 1 | Redmine Admin | |
83 | 16 | John Cary | ~~~~~~ |
84 | 29 | John Cary | brew install imagemagick |
85 | 16 | John Cary | ~~~~~~ |
86 | |||
87 | 25 | David Howdle | For Qt5: |
88 | |||
89 | ~~~~~~ |
||
90 | 29 | John Cary | brew install bison flex gperf libcapn |
91 | 25 | David Howdle | ~~~~~~ |
92 | |||
93 | If you receive a error regarding ruby version: |
||
94 | |||
95 | ~~~~~~ |
||
96 | 29 | John Cary | brew install ruby@2.3 |
97 | 25 | David Howdle | ~~~~~~ |
98 | |||
99 | 1 | Redmine Admin | If permissions end up wrong, the commands |
100 | |||
101 | ~~~~~~ |
||
102 | 29 | John Cary | chmod -R a+rX /opt/homebrew |
103 | find /opt/homebrew -type l -exec chmod -h a+r '{}' \; |
||
104 | 1 | Redmine Admin | ~~~~~~ |
105 | |||
106 | may help. |
||
107 | |||
108 | 16 | John Cary | To get fortran and a more recent version of the gcc compiler |
109 | 1 | Redmine Admin | |
110 | 14 | John Cary | ~~~~~~ |
111 | 29 | John Cary | brew install gcc@6 --with-fortran |
112 | 33 | Tech-X Corporation | |
113 | With gcc 6.5 (11/18), gfortran is installed with gcc. You will receive this informational message if you use the above command: |
||
114 | ~~~ |
||
115 | Warning: gcc@6: this formula has no --with-fortran option so it will be ignored! |
||
116 | 1 | Redmine Admin | |
117 | 36 | Nathan Neri | To get qt 4 (currently needed for Mojave): |
118 | 1 | Redmine Admin | |
119 | 36 | Nathan Neri | ~~~ |
120 | brew tap cartr/qt4 |
||
121 | brew tap-pin cartr/qt4 |
||
122 | brew install qt@4 |
||
123 | ~~~ |
||
124 | |||
125 | then install qt-webkit and qwt, and copy the frameworks: |
||
126 | 37 | Nathan Neri | |
127 | 36 | Nathan Neri | ~~~ |
128 | brew install qwt-qt4 |
||
129 | brew install qt-webkit@2.3 |
||
130 | cp -R /opt/homebrew/Cellar/qwt-qt4/6.1.3_1/lib/qwt.framework /opt/homebrea/Cellar/qt\@4/4.8.7_5/lib/ |
||
131 | cp -R /opt/homebrew/Cellar/qt-webkit\@2.3/2.3.4_1/lib/QtWebKit.framework /opt/homebrew/Cellar/qt\@4/4.8.7_5/lib/ |
||
132 | ~~~ |
||
133 | 1 | Redmine Admin | |
134 | ## LaTeX ## |
||
135 | |||
136 | 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: |
||
137 | |||
138 | ~~~~~~ |
||
139 | 29 | John Cary | setenv PATH /usr/texbin:${PATH} # For tcsh |
140 | export PATH=/usr/texbin:${PATH} # For bash |
||
141 | 1 | Redmine Admin | ~~~~~~ |
142 | 13 | Redmine Admin | |
143 | 1 | Redmine Admin | For those who like GUIs, the !TeXworks in /Applications/TeX/TeXworks should work fine. |
144 | |||
145 | 13 | Redmine Admin | For those with limited space, install BasicTeX from <https://tug.org/mactex/morepackages.html>. Add to your PATH: |
146 | |||
147 | ~~~~~~ |
||
148 | 32 | John Cary | /usr/local/texlive/2017/bin/universal-darwin/ |
149 | 13 | Redmine Admin | ~~~~~~ |
150 | |||
151 | 32 | John Cary | and then install the packages noted at |
152 | 1 | Redmine Admin | |
153 | 32 | John Cary | [[LaTeX packages needed by Bilder]] |
154 | 29 | John Cary | |
155 | 32 | John Cary | You may need to use sudo. |
156 | 1 | Redmine Admin | |
157 | ~~~~~~ |
||
158 | 32 | John Cary | sudo tlmgr update --self |
159 | sudo tlmgr install <needed packages> |
||
160 | 1 | Redmine Admin | ~~~~~~ |
161 | 29 | John Cary | |
162 | 32 | John Cary | and then used the autoupdate feature to get any additionally needed packages. This minimal installation is 230 M instead of the usual 2GB. |
163 | |||
164 | 1 | Redmine Admin | |
165 | ## Disable spindump ## |
||
166 | |||
167 | for faster compilations via |
||
168 | |||
169 | ~~~~~~ |
||
170 | sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.spindump.plist |
||
171 | 29 | John Cary | ~~~~~~ |
172 | 11 | Redmine Admin | |
173 | 34 | John Cary | ## LLVM-Clang ## |
174 | |||
175 | LLVM-Clang (aka LlvmClang) is different from AppleClang. It has support for target attributes and openmp, and provides a build chain for high-performance computing. We are currently using 7.0.0, which can be obtained from http://releases.llvm.org/7.0.0/clang+llvm-7.0.0-x86_64-apple-darwin.tar.xz. It is installed via, e.g., |
||
176 | |||
177 | cd /opt; sudo tar xf /path/to/clang+llvm-7.0.0-x86_64-apple-darwin.tar.gz |
||
178 | |||
179 | and then fixing up permissions as needed (e.g., chmod -R a+rX). |
||
180 | |||
181 | 11 | Redmine Admin | ## Java ## |
182 | |||
183 | You will need to install java by invoking the executable in any way such as... |
||
184 | |||
185 | ~~~~~~ |
||
186 | java -version |
||
187 | ~~~~~~ |
||
188 | |||
189 | 1 | Redmine Admin | 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) |
190 | |||
191 | ## HostName ## |
||
192 | |||
193 | For bilder to properly send emails the fully qualified hostname must set on the machine. To check this try... |
||
194 | 2 | Redmine Admin | |
195 | 1 | Redmine Admin | ~~~~~~ |
196 | 31 | John Cary | hostname -f |
197 | 29 | John Cary | ~~~~~~ |
198 | 1 | Redmine Admin | |
199 | 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. |
||
200 | |||
201 | ~~~~~~ |
||
202 | sudo scutil --set ComputerName "machinename" |
||
203 | sudo scutil --set LocalHostName "machinename" |
||
204 | sudo scutil --set HostName "machinename.domainname.com" |
||
205 | dscacheutil -flushcache |
||
206 | ~~~~~~ |
||
207 | |||
208 | Restart your Mac after this. |
||
209 | |||
210 | ## Power Saving Modes ## |
||
211 | |||
212 | For build machines that are not personal machines, disabling certain options will help in connectivity and responsiveness: |
||
213 | |||
214 | ~~~~~~ |
||
215 | Under Spotlight |
||
216 | - disabled the main HD. (multiple mdworkers taking up a lot of cpu.) |
||
217 | ~~~~~~ |
||
218 | |||
219 | ~~~~~~ |
||
220 | Under Energy Saver |
||
221 | - Computer sleep: Set to never |
||
222 | - Unchecked Put hard disks to sleep when possible |
||
223 | - Unchecked Wake for network access |
||
224 | ~~~~~~ |
||
225 | |||
226 | |
||
227 | |
||
228 | |
||
229 | |
||
230 | |
||
231 | |
||
232 | |
||
233 | |
||
234 | |
||
235 | |
||
236 | |||
237 | 29 | John Cary | --- |
238 | |||
239 | --- |
||
240 | |||
241 | 31 | John Cary | ## X11 ## |
242 | 1 | Redmine Admin | |
243 | 31 | John Cary | X11 should not be needed, but if it is needed: |
244 | |||
245 | Install [XQuartz X11](http://xquartz.macosforge.org/landing/). |
||
246 | |||
247 | Create a symbolic link so that the X11 headers can be found by the compiler: |
||
248 | |||
249 | ~~~~~~ |
||
250 | sudo ln -s /opt/X11/include/X11 /usr/local/include/X11 |
||
251 | ~~~~~~ |
||
252 | |||
253 | 1 | Redmine Admin | # DEPRECATED INSTRUCTIONS # |
254 | 31 | John Cary | |
255 | |||
256 | ## Other gfortran options (besides HomeBrew) ## |
||
257 | |||
258 | ### Option 2: HPC ### |
||
259 | |||
260 | Install gfortran from [SourceForge HPC](http://hpc.sourceforge.net). (Do not also install the other gcc compilers.) |
||
261 | |||
262 | As of March 29, 2015, the version is 4.9.0. |
||
263 | |||
264 | Install via |
||
265 | |||
266 | ~~~~~~ |
||
267 | $ tar xzf gfortran-4.9-bin.tar.gz -C / |
||
268 | ~~~~~~ |
||
269 | |||
270 | ### Option 3: GNU ### |
||
271 | |||
272 | Install gfortran using the installer from <http://gcc.gnu.org/wiki/GFortranBinaries>. |
||
273 | |||
274 | As of March 29, 2015, the version is 4.9.0. |
||
275 | |||
276 | The binaries will end up being installed in /usr/local/bin |
||
277 | |||
278 | 30 | John Cary | |
279 | ## Git ## |
||
280 | |||
281 | 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. |
||
282 | 11 | Redmine Admin | |
283 | 1 | Redmine Admin | |
284 | 10 | Redmine Admin | ### Macports ### |
285 | |||
286 | This provides wget, freetype, and other utilities. Get macports from <http://www.macports.org/install.php> and install. |
||
287 | 11 | Redmine Admin | |
288 | Note: Before proceeding with the installation of various macports packages noted below on Lion machines with Xcode 4.3, one needs to run |
||
289 | |||
290 | 10 | Redmine Admin | ~~~~~~ |
291 | 29 | John Cary | sudo xcode-select -switch /Applications/Xcode.app |
292 | 10 | Redmine Admin | ~~~~~~ |
293 | |||
294 | Otherwise, there will be an error installing zlib during the wget installation below. |
||
295 | 11 | Redmine Admin | |
296 | After the macports installation, do |
||
297 | 1 | Redmine Admin | |
298 | ~~~~~~ |
||
299 | 29 | John Cary | sudo port install wget |
300 | sudo port install ImageMagick +no_x11 |
||
301 | sudo port install f2c |
||
302 | 1 | Redmine Admin | ~~~~~~ |
303 | |||
304 | |||
305 | ### XCode ### |
||
306 | ### Lion ### |
||
307 | 11 | Redmine Admin | |
308 | 1 | Redmine Admin | On Lion, the command line compilers are not installed automatically. After installing Xcode, navigate to the |
309 | Preferences->Download dialog |
||
310 | and install the Command Line Tools. The dialog is.. |
||
311 | 2 | Redmine Admin | |
312 | 1 | Redmine Admin | !screenShotCommandLineTools.png! |
313 | |||
314 | or from the command line do |
||
315 | |||
316 | 11 | Redmine Admin | ~~~~~~ |
317 | 29 | John Cary | sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer/ |
318 | xcodebuild |
||
319 | 1 | Redmine Admin | (hit agree) |
320 | ~~~~~~ |
||
321 | |||
322 | You may subsequently need to build your first package with sudo in order to accept the Xcode licenses. |
||
323 | |||
324 | ### Mountain Lion ### |
||
325 | |||
326 | Same as Mavericks? |
||
327 | |||
328 | ### Mavericks ### |
||
329 | |||
330 | 2 | Redmine Admin | ~~~~~~ |
331 | 29 | John Cary | sudo xcode-select --install |
332 | 1 | Redmine Admin | ~~~~~~ |
333 | |||
334 | |||
335 | ## Java ## |
||
336 | |||
337 | (The below does not apply to yosemite.) |
||
338 | |||
339 | The cmake build may fail due to missing java headers linked to in /System/Library/Frameworks/JavaVM.framework/Headers. To fix: |
||
340 | |||
341 | ~~~~~~ |
||
342 | 29 | John Cary | cd /System/Library/Frameworks/JavaVM.framework/Headers |
343 | sudo mv jni.h jni.h.missing |
||
344 | 1 | Redmine Admin | ~~~~~~ |