Project

General

Profile

Preparing a Mac machine for Bilder » History » Version 34

John Cary, 01/08/2019 10:17 AM

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