Project

General

Profile

Preparing a Mac machine for Bilder » History » Version 84

David Alexander, 02/23/2022 02:49 PM

1 2 Redmine Admin
# Preparing a Mac machine for Bilder #
2 1 Redmine Admin
3 70 John Cary
*NOTE: as of Catalina, installing in /opt is no longer an option, so we have moved to /usr/local*
4
5 24 John Cary
__If all you need is python and sphinx__ (e.g., for builds of documentation), then you need only
6
7
* XCode with command line tools
8
* Latex installed as noted below
9
10
and then you can add the arguments,  -W python, and your installed Python and CMake will be used if your path is correct.
11
12
13 2 Redmine Admin
## Bilder on Darwin ##
14 1 Redmine Admin
15 16 John Cary
Darwin comes with bash, so it is Bilder ready for the most part.
16 1 Redmine Admin
17 16 John Cary
### OS X Versions ###
18 1 Redmine Admin
19 16 John Cary
Yosemite's XCode that supports C++ 11 by default.
20 1 Redmine Admin
21 16 John Cary
El Capitan's clang compiler supports OpenMP.
22
23 1 Redmine Admin
## Case insensitive file system ##
24
25
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.
26
27 2 Redmine Admin
## C and C++ compilers and Xcode command line tools ##
28 1 Redmine Admin
29 83 David Alexander
Install Xcode. To obtain version 11.3 (11.x is required for LLVM@12), 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. Also download the Command Line Tools to match the version of Xcode that you are getting. The Xcode.app directory that is unpacked by opening the .xip file should be moved to the /Applications/ folder. The Command Line Tools is a DMG that has a PKG installer, so just run that. One must additionally execute this command before using any command line tools:
30 1 Redmine Admin
31
~~~~~~
32 83 David Alexander
sudo xcodebuild -license
33 1 Redmine Admin
~~~~~~
34
35 83 David Alexander
If you are upgrading from a previous installation you will want/need to run the following command
36 35 John Cary
37
~~~~~~
38 83 David Alexander
sudo xcode-select -s /Applications/Xcode.app
39 1 Redmine Admin
~~~~~~
40
41 83 David Alexander
One can check the version of Xcode from the command-line with
42 69 John Cary
43 83 David Alexander
~~~~~
44
xcodebuild -version
45
/usr/bin/clang --version
46 69 John Cary
~~~~~~
47 65 David Alexander
48 83 David Alexander
The clang should be version 11.0.0 with Xcode 11.3.1.
49 1 Redmine Admin
50
## HomeBrew ##
51 70 John Cary
52 1 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 /usr/local/homebrew, thus making removal a matter removing a directory and then removing broken links in /usr/local/homebrew.
53 14 John Cary
54 84 David Alexander
HomeBrew requires that one not have root privileges, but /usr/local is owned by root, we make the directory into which we can write. If you are in the admin group on your own Mac, then you can run the following commands:
55 1 Redmine Admin
56
~~~~~~
57 14 John Cary
cd /usr/local
58 84 David Alexander
sudo mkdir homebrew
59
sudo chown `whoami` homebrew
60
chgrp admin homebrew
61
chmod 2775 homebrew
62 70 John Cary
git clone https://github.com/Homebrew/brew.git homebrew
63 57 John Cary
~~~~~~
64
65 84 David Alexander
These commands are useful if you do encounter any permissions problems or are on a Mac that is shared for building.
66
67 1 Redmine Admin
~~~~~~
68
chmod -R a+rX /usr/local/homebrew
69 73 Benjamin Cowan
find /usr/local/homebrew -type l -exec chmod -h a+r '{}' \;
70 1 Redmine Admin
~~~~~~
71 39 David Alexander
72 84 David Alexander
Finally, as root execute these lines to pick up some paths in the defaults paths:
73 1 Redmine Admin
74 29 John Cary
~~~~~~
75 70 John Cary
sudo -s
76
echo "/usr/local/homebrew/bin" > /etc/paths.d/homebrew
77 29 John Cary
echo "/usr/local/homebrew/share/man" > /etc/manpaths.d/homebrew
78
chmod a+r /etc/paths.d/homebrew /etc/manpaths.d/homebrew
79 1 Redmine Admin
exit
80
~~~~~~
81 82 John Cary
82 1 Redmine Admin
Get various packages...
83 16 John Cary
84 82 John Cary
~~~~~~
85 16 John Cary
brew install subversion gnupg libpng freetype gd ghostscript ninja wget imagemagick
86
~~~~~~
87 45 Nathan Neri
88
git large file support (for VisIt)
89
90
~~~~~~
91 56 Nathan Neri
brew install git-lfs
92 45 Nathan Neri
git lfs install --force --skip-smudge
93
~~~~~~
94 25 David Howdle
95
For Qt5:
96
97
~~~~~~
98 39 David Alexander
brew install bison flex gperf libcapn
99 1 Redmine Admin
~~~~~~
100 79 John Cary
101 75 Tech-X Corporation
Fortran comes with the homebrew gcc compiler:
102
103 81 David Alexander
~~~~~~
104 1 Redmine Admin
brew install gcc
105
~~~~~~
106 81 David Alexander
107 79 John Cary
As of Sep 2021, version 11.2 has been tried with success.
108 1 Redmine Admin
However, it does not work an Apple Silicon (M1), so you must instead get it from https://github.com/fxcoudert/gfortran-for-macOS/releases/tag/11-arm-alpha2.
109 39 David Alexander
110
OPTIONAL:
111
112
If you receive an error regarding ruby version:
113
114
~~~~~~
115
brew install ruby@2.3
116
~~~~~~
117
118
may help.
119 1 Redmine Admin
120
121
## LaTeX ##
122
123 29 John Cary
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:
124
125 1 Redmine Admin
~~~~~~
126 13 Redmine Admin
setenv PATH /usr/texbin:${PATH}  # For tcsh
127 1 Redmine Admin
export PATH=/usr/texbin:${PATH}  # For bash
128
~~~~~~
129 13 Redmine Admin
130
For those who like GUIs, the !TeXworks in /Applications/TeX/TeXworks should work fine.
131
132 32 John Cary
For those with limited space, install BasicTeX from <https://tug.org/mactex/morepackages.html>. Add to your PATH:
133 13 Redmine Admin
134
~~~~~~
135 32 John Cary
    /usr/local/texlive/2017/bin/universal-darwin/
136 1 Redmine Admin
~~~~~~
137 32 John Cary
138 29 John Cary
and then install the packages noted at
139 32 John Cary
140 1 Redmine Admin
[[LaTeX packages needed by Bilder]]
141
142 32 John Cary
You may need to use sudo.
143
144 1 Redmine Admin
~~~~~~
145 29 John Cary
sudo tlmgr update --self
146 32 John Cary
sudo tlmgr install <needed packages>
147
~~~~~~
148 1 Redmine Admin
149
and then used the autoupdate feature to get any additionally needed packages.  This minimal installation is 230 M instead of the usual 2GB.
150
151
152
## Disable spindump ##
153
154
for faster compilations via
155
156
~~~~~~
157 58 John Cary
sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.spindump.plist
158
~~~~~~
159 67 David Alexander
160 58 John Cary
## LLVM-Clang ##
161
162
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.  Check out the llvm-project of your chosen version.
163
164
We use homebrew to install this with
165 61 John Cary
166 71 David Alexander
~~~~~~
167 83 David Alexander
brew install llvm@12
168 1 Redmine Admin
~~~~~~
169 78 John Cary
170 83 David Alexander
As of Feb 2022, the default llvm version is 13 and that would be probably fine, however 12 is tested and is known to be ok.
171 78 John Cary
172 1 Redmine Admin
ALTERNATIVE
173 78 John Cary
174 1 Redmine Admin
If brew does not work (e.g., it is not available for M1), then you can download a release from https://github.com/llvm/llvm-project/releases.
175
176 48 Nathan Neri
To configure and build:
177 49 Nathan Neri
178 80 John Cary
~~~~~~
179
llvmver=12.0.0 # Correct as needed.
180
tar xf llvmorg-$llvmver.tar.gz
181 1 Redmine Admin
cd llvm-project-llvmorg-$llvmver
182
mkdir build
183 80 John Cary
cd build
184 77 John Cary
cmake ../llvm -DLLVM_ENABLE_PROJECTS="clang;openmp;libcxx;libcxxabi" -DLLVM_ENABLE_RTTI:BOOL=ON -DLLVM_ENABLE_EH:BOOL=ON -DCMAKE_INSTALL_PREFIX:PATH="/usr/local/opt/llvm-$llvmver/install" -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_NAME_DIR=/usr/local/opt/llvm-$llvmver/install/lib
185 54 David Alexander
make # Add appropriate -j argument for the machine to build faster
186
          # with -j 8 on qamojavellvm the build and installation took a little under an hour
187 48 Nathan Neri
make install
188
~~~~~~
189
190 43 Tech-X Corporation
Bilder will look in /opt/llvmclang/bin for llvm binaries (as well as $LLVM_DIR/bin, and your installation dir/bin, in case you need to keep multiple versions for different builds), so we set a link to the installation directory in the chosen version of llvm:
191 44 Tech-X Corporation
192 78 John Cary
~~~~~~
193 48 Nathan Neri
cd /usr/local/opt
194 44 Tech-X Corporation
sudo ln -s llvm-<Version>/install llvmclang
195 43 Tech-X Corporation
~~~~~~
196 11 Redmine Admin
197
## Java ##
198
199
You will need to install java by invoking the executable in any way such as...
200
201
~~~~~~
202 1 Redmine Admin
java -version
203
~~~~~~
204 74 Tech-X Corporation
205
Follow the instructions in the dialog that takes you to the Oracle website and choose the latest version to download.  (As of March 2021 this is 16.)
206
207
Chose the macOS installer from
208 1 Redmine Admin
https://www.oracle.com/java/technologies/javase-jdk16-downloads.html
209
210 2 Redmine Admin
## HostName ##
211 1 Redmine Admin
212 31 John Cary
For bilder to properly send emails the fully qualified hostname must set on the machine. To check this try...
213 29 John Cary
214 1 Redmine Admin
~~~~~~
215
hostname -f
216
~~~~~~
217
218
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.
219
220
~~~~~~
221
sudo scutil --set ComputerName "machinename"
222
sudo scutil --set LocalHostName "machinename"
223
sudo scutil --set HostName "machinename.domainname.com"
224
dscacheutil -flushcache
225
~~~~~~
226
227
Restart your Mac after this.
228
229
## Power Saving Modes ##
230
231
For build machines that are not personal machines, disabling certain options will help in connectivity and responsiveness:
232
233
~~~~~~
234
Under Spotlight
235
 - disabled the main HD. (multiple mdworkers taking up a lot of cpu.)
236
~~~~~~
237
238
~~~~~~
239
Under Energy Saver
240
 - Computer sleep: Set to never
241
 - Unchecked Put hard disks to sleep when possible
242
 - Unchecked Wake for network access
243
~~~~~~
244
245
&nbsp;
246
&nbsp;
247
&nbsp;
248
&nbsp;
249
&nbsp;
250
&nbsp;
251
&nbsp;
252
&nbsp;
253 29 John Cary
&nbsp;
254
&nbsp;
255
256
---
257 31 John Cary
258 1 Redmine Admin
---
259 31 John Cary
260
## X11 ##
261
262
X11 should not be needed, but if it is needed:
263
264
Install [XQuartz X11](http://xquartz.macosforge.org/landing/).
265
266
Create a symbolic link so that the X11 headers can be found by the compiler:
267
268
~~~~~~
269 1 Redmine Admin
sudo ln -s /opt/X11/include/X11 /usr/local/include/X11
270 31 John Cary
~~~~~~
271
272
# DEPRECATED INSTRUCTIONS #
273
274
275
## Other gfortran options (besides HomeBrew) ##
276
277
### Option 2: HPC ###
278
279
Install gfortran from [SourceForge HPC](http://hpc.sourceforge.net).  (Do not also install the other gcc compilers.)
280
281
As of March 29, 2015, the version is 4.9.0.
282
283
Install via
284
285
~~~~~~
286
$ tar xzf gfortran-4.9-bin.tar.gz -C /
287
~~~~~~
288
289
### Option 3: GNU ###
290
291
Install gfortran using the installer from <http://gcc.gnu.org/wiki/GFortranBinaries>.
292
293
As of March 29, 2015, the version is 4.9.0.
294 30 John Cary
295
The binaries will end up being installed in /usr/local/bin
296
297
298 11 Redmine Admin
## Git ##
299 1 Redmine Admin
300 10 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.
301
302
303 11 Redmine Admin
### Macports ### 
304
305
This provides wget, freetype, and other utilities. Get macports from <http://www.macports.org/install.php> and install.
306 10 Redmine Admin
307 29 John Cary
Note: Before proceeding with the installation of various macports packages noted below on Lion machines with Xcode 4.3, one needs to run
308 10 Redmine Admin
309
~~~~~~
310
sudo xcode-select -switch /Applications/Xcode.app
311 11 Redmine Admin
~~~~~~
312
313 1 Redmine Admin
Otherwise, there will be an error installing zlib during the wget installation below.
314
315 29 John Cary
After the macports installation, do
316
317
~~~~~~
318 1 Redmine Admin
sudo port install wget
319
sudo port install ImageMagick +no_x11
320
sudo port install f2c
321
~~~~~~
322
323 11 Redmine Admin
324 1 Redmine Admin
### XCode ###
325
### Lion ###
326
327 2 Redmine Admin
On Lion, the command line compilers are not installed automatically. After installing Xcode, navigate to the 
328 1 Redmine Admin
Preferences->Download dialog 
329
and install the Command Line Tools. The dialog is.. 
330
331
!screenShotCommandLineTools.png!
332 11 Redmine Admin
333 29 John Cary
or from the command line do
334
335 1 Redmine Admin
~~~~~~
336
sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer/
337
xcodebuild
338
      (hit agree)
339
~~~~~~
340
341
You may subsequently need to build your first package with sudo in order to accept the Xcode licenses.
342
343
### Mountain Lion ### 
344
345
Same as Mavericks?
346 2 Redmine Admin
347 29 John Cary
### Mavericks ###
348 1 Redmine Admin
349
~~~~~~
350
sudo xcode-select --install
351
~~~~~~
352
353
354
## Java ##
355
356
(The below does not apply to yosemite.)
357
358 29 John Cary
The cmake build may fail due to missing java headers linked to in /System/Library/Frameworks/JavaVM.framework/Headers. To fix:
359
360 1 Redmine Admin
~~~~~~
361
cd /System/Library/Frameworks/JavaVM.framework/Headers
362
sudo mv jni.h jni.h.missing
363
~~~~~~