Project

General

Profile

Preparing a Mac machine for Bilder » History » Version 41

David Alexander, 01/30/2019 03:34 PM

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 39 David Alexander
~~~~~~
62
63
~~~~~~
64 29 John Cary
chmod -R a+rX /opt/homebrew
65 14 John Cary
find /opt/homebrew -type l -exec chmod -h a+r '{}' \;
66 1 Redmine Admin
~~~~~~
67
68 39 David Alexander
These last too lines can be reused at anytime there is a permissions problem.
69 1 Redmine Admin
70 39 David Alexander
As root again execute these lines to pick up some paths in the defaults paths:
71
72 1 Redmine Admin
~~~~~~
73 29 John Cary
sudo -s
74
echo "/opt/homebrew/bin" > /etc/paths.d/homebrew
75
echo "/opt/homebrew/share/man" > /etc/manpaths.d/homebrew
76
chmod a+r /etc/paths.d/homebrew /etc/manpaths.d/homebrew
77
exit
78 1 Redmine Admin
~~~~~~
79
80
Get the required packages...
81
82
~~~~~~
83 29 John Cary
brew install gnupg libpng freetype gd ghostscript
84 1 Redmine Admin
~~~~~~
85
86 16 John Cary
Nice to have:
87 1 Redmine Admin
88 16 John Cary
~~~~~~
89 29 John Cary
brew install imagemagick
90 16 John Cary
~~~~~~
91
92 25 David Howdle
For Qt5:
93
94
~~~~~~
95
brew install bison flex gperf libcapn
96 1 Redmine Admin
~~~~~~
97 25 David Howdle
98 39 David Alexander
To get fortran, which comes with the gcc compiler:
99 1 Redmine Admin
100
~~~~~~
101 39 David Alexander
brew install gcc@6
102 1 Redmine Admin
~~~~~~
103
104 39 David Alexander
With versions older than gcc 6.5 (released Nov 2018) possibly needed for OSs older than Mojave, gfortran is not installed with gcc and you need to add the following argument "--with-fortran" to the above brew install command.
105 1 Redmine Admin
106 39 David Alexander
To get qt 4 (needed for Mojave):
107 1 Redmine Admin
108
~~~~~~
109 38 John Cary
brew tap cartr/qt4
110 1 Redmine Admin
brew tap-pin cartr/qt4
111 33 Tech-X Corporation
brew install qt@4
112 39 David Alexander
~~~~~~
113 38 John Cary
114 40 David Alexander
As of Jan 22, 2019, (see https://github.com/dart-lang/homebrew-dart/issues/58) this is failing with an error that says "MacOS.prefer_64_bit is deprecated" 
115
116
~~~~~~
117
Error: An exception occurred within a child process:
118
  MethodDeprecatedError: Calling MacOS.prefer_64_bit? is disabled! There is no replacement.
119
Please report this to the cartr/qt4 tap:
120
  /opt/homebrew/Library/Taps/cartr/homebrew-qt4/qt@4.rb:129
121
~~~~~~
122
123 41 David Alexander
So just edit the ruby script at line 129 and take out the check of prefer_64_bit and use what's inside the prefer part of the block and remove the else. Then rerun this brew command
124
125
~~~~~~
126
brew install /opt/homebrew/Library/Taps/cartr/homebrew-qt4/qt@4.rb
127
~~~~~~
128 40 David Alexander
129
After qt@4 installs, install qt-webkit and qwt, and copy the frameworks:
130 36 Nathan Neri
131 39 David Alexander
~~~~~~
132 36 Nathan Neri
brew install qwt-qt4
133
brew install qt-webkit@2.3
134
cp -R /opt/homebrew/Cellar/qwt-qt4/6.1.3_1/lib/qwt.framework /opt/homebrea/Cellar/qt\@4/4.8.7_5/lib/
135
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/
136 39 David Alexander
~~~~~~
137
138
OPTIONAL:
139
140
If you receive an error regarding ruby version:
141
142
~~~~~~
143
brew install ruby@2.3
144
~~~~~~
145
146
may help.
147
148 1 Redmine Admin
149
## LaTeX ##
150
151
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:
152 29 John Cary
153
~~~~~~
154 1 Redmine Admin
setenv PATH /usr/texbin:${PATH}  # For tcsh
155 13 Redmine Admin
export PATH=/usr/texbin:${PATH}  # For bash
156 1 Redmine Admin
~~~~~~
157
158 13 Redmine Admin
For those who like GUIs, the !TeXworks in /Applications/TeX/TeXworks should work fine.
159
160
For those with limited space, install BasicTeX from <https://tug.org/mactex/morepackages.html>. Add to your PATH:
161 32 John Cary
162 13 Redmine Admin
~~~~~~
163
    /usr/local/texlive/2017/bin/universal-darwin/
164 32 John Cary
~~~~~~
165 1 Redmine Admin
166 32 John Cary
and then install the packages noted at
167 29 John Cary
168 32 John Cary
[[LaTeX packages needed by Bilder]]
169 1 Redmine Admin
170
You may need to use sudo.
171 32 John Cary
172
~~~~~~
173 1 Redmine Admin
sudo tlmgr update --self
174 29 John Cary
sudo tlmgr install <needed packages>
175 32 John Cary
~~~~~~
176
177 1 Redmine Admin
and then used the autoupdate feature to get any additionally needed packages.  This minimal installation is 230 M instead of the usual 2GB.
178
179
180
## Disable spindump ##
181
182
for faster compilations via
183
184 29 John Cary
~~~~~~
185 11 Redmine Admin
sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.spindump.plist
186 34 John Cary
~~~~~~
187
188
## LLVM-Clang ##
189
190
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.,
191
192
  cd /opt; sudo tar xf /path/to/clang+llvm-7.0.0-x86_64-apple-darwin.tar.gz
193
194 11 Redmine Admin
and then fixing up permissions as needed (e.g., chmod -R a+rX).
195
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 1 Redmine Admin
~~~~~~
203
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 2 Redmine Admin
208 1 Redmine Admin
For bilder to properly send emails the fully qualified hostname must set on the machine. To check this try...
209 31 John Cary
210 29 John Cary
~~~~~~
211 1 Redmine Admin
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 "machinename"
218
sudo scutil --set LocalHostName "machinename"
219
sudo scutil --set HostName "machinename.domainname.com"
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
Under Spotlight
231
 - 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
 - Unchecked Wake for network access
239
~~~~~~
240
241
&nbsp;
242
&nbsp;
243
&nbsp;
244
&nbsp;
245
&nbsp;
246
&nbsp;
247
&nbsp;
248
&nbsp;
249
&nbsp;
250 29 John Cary
&nbsp;
251
252
---
253
254 31 John Cary
---
255 1 Redmine Admin
256 31 John Cary
## X11 ##
257
258
X11 should not be needed, but if it is needed:
259
260
Install [XQuartz X11](http://xquartz.macosforge.org/landing/).
261
262
Create a symbolic link so that the X11 headers can be found by the compiler:
263
264
~~~~~~
265
sudo ln -s /opt/X11/include/X11 /usr/local/include/X11
266 1 Redmine Admin
~~~~~~
267 31 John Cary
268
# DEPRECATED INSTRUCTIONS #
269
270
271
## Other gfortran options (besides HomeBrew) ##
272
273
### Option 2: HPC ###
274
275
Install gfortran from [SourceForge HPC](http://hpc.sourceforge.net).  (Do not also install the other gcc compilers.)
276
277
As of March 29, 2015, the version is 4.9.0.
278
279
Install via
280
281
~~~~~~
282
$ tar xzf gfortran-4.9-bin.tar.gz -C /
283
~~~~~~
284
285
### Option 3: GNU ###
286
287
Install gfortran using the installer from <http://gcc.gnu.org/wiki/GFortranBinaries>.
288
289
As of March 29, 2015, the version is 4.9.0.
290
291 30 John Cary
The binaries will end up being installed in /usr/local/bin
292
293
294
## Git ##
295 11 Redmine Admin
296 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.
297 10 Redmine Admin
298
299
### Macports ### 
300 11 Redmine Admin
301
This provides wget, freetype, and other utilities. Get macports from <http://www.macports.org/install.php> and install.
302
303 10 Redmine Admin
Note: Before proceeding with the installation of various macports packages noted below on Lion machines with Xcode 4.3, one needs to run
304 29 John Cary
305 10 Redmine Admin
~~~~~~
306
sudo xcode-select -switch /Applications/Xcode.app
307
~~~~~~
308 11 Redmine Admin
309
Otherwise, there will be an error installing zlib during the wget installation below.
310 1 Redmine Admin
311
After the macports installation, do
312 29 John Cary
313
~~~~~~
314
sudo port install wget
315 1 Redmine Admin
sudo port install ImageMagick +no_x11
316
sudo port install f2c
317
~~~~~~
318
319
320 11 Redmine Admin
### XCode ###
321 1 Redmine Admin
### Lion ###
322
323
On Lion, the command line compilers are not installed automatically. After installing Xcode, navigate to the 
324 2 Redmine Admin
Preferences->Download dialog 
325 1 Redmine Admin
and install the Command Line Tools. The dialog is.. 
326
327
!screenShotCommandLineTools.png!
328
329 11 Redmine Admin
or from the command line do
330 29 John Cary
331
~~~~~~
332 1 Redmine Admin
sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer/
333
xcodebuild
334
      (hit agree)
335
~~~~~~
336
337
You may subsequently need to build your first package with sudo in order to accept the Xcode licenses.
338
339
### Mountain Lion ### 
340
341
Same as Mavericks?
342
343 2 Redmine Admin
### Mavericks ###
344 29 John Cary
345 1 Redmine Admin
~~~~~~
346
sudo xcode-select --install
347
~~~~~~
348
349
350
## Java ##
351
352
(The below does not apply to yosemite.)
353
354
The cmake build may fail due to missing java headers linked to in /System/Library/Frameworks/JavaVM.framework/Headers. To fix:
355 29 John Cary
356
~~~~~~
357 1 Redmine Admin
cd /System/Library/Frameworks/JavaVM.framework/Headers
358
sudo mv jni.h jni.h.missing
359
~~~~~~