Project

General

Profile

Preparing a Mac machine for Bilder » History » Version 105

John Cary, 10/09/2024 06:15 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
### OS X Versions ###
16 16 John Cary
17 103 John Cary
XCode that supports C++ 11 and OpenMP.  This has been true for several year.
18 16 John Cary
19 1 Redmine Admin
## Case insensitive file system ##
20
21
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.
22
23
## C and C++ compilers and Xcode command line tools ##
24 2 Redmine Admin
25 103 John Cary
Install at least Xcode 14.2 (14.2 has been tested as of 2024 Jun 5, but later versions might work as well).  We are currently using 15.4.  
26 101 David Alexander
27 103 John Cary
To obtain Xcode visit https://developer.apple.com/download/all/.  or older versions 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:
28 1 Redmine Admin
29
~~~~~~
30 83 David Alexander
sudo xcodebuild -license
31 1 Redmine Admin
~~~~~~
32
33 83 David Alexander
If you are upgrading from a previous installation you will want/need to run the following command
34 35 John Cary
35
~~~~~~
36 83 David Alexander
sudo xcode-select -s /Applications/Xcode.app
37 1 Redmine Admin
~~~~~~
38
39 83 David Alexander
One can check the version of Xcode from the command-line with
40 69 John Cary
41 83 David Alexander
~~~~~
42
xcodebuild -version
43
/usr/bin/clang --version
44 69 John Cary
~~~~~~
45 1 Redmine Admin
46 65 David Alexander
The clang should be version 14.0.0 with Xcode 14.2.
47 1 Redmine Admin
48
## HomeBrew ##
49
50
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 `$HOMEBREWDIR` with $HOMEBREWDIR being either `/usr/local/homebrew` if on Intel Mac, or `/opt/homebrew` if on Apple ARM architecture (M1, M2, etc.).  Thus removal of a package a matter removing a directory and then removing broken links in $HOMEBREWDIR.
51
52 103 John Cary
To install homebrew, go to https://brew.sh  and follow the installation directions.  Our approach is
53 1 Redmine Admin
54 103 John Cary
`cd /opt
55
sudo mkdir homebrew
56
sudo chown $USER homebrew
57
sudo chmod 2775
58 105 John Cary
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"`
59 103 John Cary
60 82 John Cary
Get various packages...
61 16 John Cary
62 82 John Cary
~~~~~~
63 103 John Cary
brew install subversion gnupg libpng freetype gd ghostscript ninja wget imagemagick bison flex gperf libcapn pkg-config curl
64 16 John Cary
~~~~~~
65 45 Nathan Neri
66
git large file support (for VisIt)
67
68 56 Nathan Neri
~~~~~~
69 1 Redmine Admin
brew install git-lfs
70 79 John Cary
git lfs install --force --skip-smudge
71 1 Redmine Admin
~~~~~~
72 92 David Alexander
73 104 John Cary
Compilers
74 88 John Cary
75 1 Redmine Admin
~~~~~~
76 104 John Cary
brew install llvm
77
brew install gcc
78 88 John Cary
~~~~~~
79 90 David Alexander
80 103 John Cary
The homebrew gcc compiler includes gfortran.
81 81 David Alexander
82 103 John Cary
Perhaps no longer needed:
83 100 David Alexander
~~~~~~
84 103 John Cary
brew install qt@5 # ARM only. Qt is version 5.15.10 as of 7/3/2023
85 39 David Alexander
~~~~~~
86
87
OPTIONAL:
88
89
If you receive an error regarding ruby version:
90
91
~~~~~~
92
brew install ruby@2.3
93
~~~~~~
94
95 1 Redmine Admin
may help.
96
97
98
## LaTeX ##
99 29 John Cary
100
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:
101 1 Redmine Admin
102 13 Redmine Admin
~~~~~~
103 1 Redmine Admin
setenv PATH /usr/texbin:${PATH}  # For tcsh
104
export PATH=/usr/texbin:${PATH}  # For bash
105 13 Redmine Admin
~~~~~~
106
107
For those who like GUIs, the !TeXworks in /Applications/TeX/TeXworks should work fine.
108 32 John Cary
109 13 Redmine Admin
For those with limited space, install BasicTeX from <https://tug.org/mactex/morepackages.html>. Add to your PATH:
110
111 32 John Cary
~~~~~~
112 1 Redmine Admin
    /usr/local/texlive/2017/bin/universal-darwin/
113 32 John Cary
~~~~~~
114 29 John Cary
115 32 John Cary
and then install the packages noted at
116 1 Redmine Admin
117
[[LaTeX packages needed by Bilder]]
118 32 John Cary
119
You may need to use sudo.
120 1 Redmine Admin
121 29 John Cary
~~~~~~
122 32 John Cary
sudo tlmgr update --self
123
sudo tlmgr install <needed packages>
124 1 Redmine Admin
~~~~~~
125
126
and then used the autoupdate feature to get any additionally needed packages.  This minimal installation is 230 M instead of the usual 2GB.
127
128
129
## Disable spindump ##
130
131
for faster compilations via
132
133 58 John Cary
~~~~~~
134
sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.spindump.plist
135 67 David Alexander
~~~~~~
136 97 John Cary
137 58 John Cary
## LLVM-Clang ##
138
139
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.
140
141 61 John Cary
We use homebrew to install this with
142 71 David Alexander
143 98 John Cary
~~~~~~
144 48 Nathan Neri
brew install llvm@15
145 44 Tech-X Corporation
~~~~~~
146 98 John Cary
147 11 Redmine Admin
As of Jul 2023, the default llvm version is 16, but it will not build Trilinos.  LLVM-15 is the first version to have OpenMP support on the M1 chips.  LLVM-12 is well tested for non-M1 Mac's.
148
149
## Java ##
150
151
You will need to install java by invoking the executable in any way such as...
152
153 1 Redmine Admin
~~~~~~
154
java -version
155 74 Tech-X Corporation
~~~~~~
156
157
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.)
158
159 1 Redmine Admin
Chose the macOS installer from
160
https://www.oracle.com/java/technologies/javase-jdk16-downloads.html
161 2 Redmine Admin
162 1 Redmine Admin
## HostName ##
163 31 John Cary
164 29 John Cary
For bilder to properly send emails the fully qualified hostname must set on the machine. To check this try...
165 1 Redmine Admin
166
~~~~~~
167
hostname -f
168
~~~~~~
169
170
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.
171
172
~~~~~~
173
sudo scutil --set ComputerName "machinename"
174
sudo scutil --set LocalHostName "machinename"
175
sudo scutil --set HostName "machinename.domainname.com"
176
dscacheutil -flushcache
177
~~~~~~
178
179
Restart your Mac after this.
180
181
## Power Saving Modes ##
182
183
For build machines that are not personal machines, disabling certain options will help in connectivity and responsiveness:
184
185
~~~~~~
186
Under Spotlight
187
 - disabled the main HD. (multiple mdworkers taking up a lot of cpu.)
188
~~~~~~
189
190
~~~~~~
191
Under Energy Saver
192
 - Computer sleep: Set to never
193
 - Unchecked Put hard disks to sleep when possible
194
 - Unchecked Wake for network access
195
~~~~~~
196 99 David Alexander
197
## Python ##
198
199
For some older packages the "python" binary might be needed. Homebrew no longer supports installing Python2. Individual packages may expect "python" to be from Python2 or Python3, so it not clear if Python2 is needed to be installed or if one can link the python executable to the python3 one. One can install Python2, in any case from https://python.org/downloads.
200
201
202
203 1 Redmine Admin
204
&nbsp;
205
&nbsp;
206
&nbsp;
207
&nbsp;
208
&nbsp;
209
&nbsp;
210
&nbsp;
211 29 John Cary
&nbsp;
212
&nbsp;
213
&nbsp;
214
215 31 John Cary
---
216 1 Redmine Admin
217 31 John Cary
---
218
219
## X11 ##
220
221
X11 should not be needed, but if it is needed:
222
223
Install [XQuartz X11](http://xquartz.macosforge.org/landing/).
224
225
Create a symbolic link so that the X11 headers can be found by the compiler:
226
227 1 Redmine Admin
~~~~~~
228 31 John Cary
sudo ln -s /opt/X11/include/X11 /usr/local/include/X11
229
~~~~~~
230
231
# DEPRECATED INSTRUCTIONS #
232
233
234
## Other gfortran options (besides HomeBrew) ##
235
236
### Option 2: HPC ###
237
238
Install gfortran from [SourceForge HPC](http://hpc.sourceforge.net).  (Do not also install the other gcc compilers.)
239
240
As of March 29, 2015, the version is 4.9.0.
241
242
Install via
243
244
~~~~~~
245
$ tar xzf gfortran-4.9-bin.tar.gz -C /
246
~~~~~~
247
248
### Option 3: GNU ###
249
250
Install gfortran using the installer from <http://gcc.gnu.org/wiki/GFortranBinaries>.
251
252 30 John Cary
As of March 29, 2015, the version is 4.9.0.
253
254
The binaries will end up being installed in /usr/local/bin
255
256 11 Redmine Admin
257 1 Redmine Admin
## Git ##
258 10 Redmine Admin
259
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.
260
261 11 Redmine Admin
262
### Macports ### 
263
264 10 Redmine Admin
This provides wget, freetype, and other utilities. Get macports from <http://www.macports.org/install.php> and install.
265 29 John Cary
266 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
267
268
~~~~~~
269 11 Redmine Admin
sudo xcode-select -switch /Applications/Xcode.app
270
~~~~~~
271 1 Redmine Admin
272
Otherwise, there will be an error installing zlib during the wget installation below.
273 29 John Cary
274
After the macports installation, do
275
276 1 Redmine Admin
~~~~~~
277
sudo port install wget
278
sudo port install ImageMagick +no_x11
279
sudo port install f2c
280
~~~~~~
281 11 Redmine Admin
282 1 Redmine Admin
283
### XCode ###
284
### Lion ###
285 2 Redmine Admin
286 1 Redmine Admin
On Lion, the command line compilers are not installed automatically. After installing Xcode, navigate to the 
287
Preferences->Download dialog 
288
and install the Command Line Tools. The dialog is.. 
289
290 11 Redmine Admin
!screenShotCommandLineTools.png!
291 29 John Cary
292
or from the command line do
293 1 Redmine Admin
294
~~~~~~
295
sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer/
296
xcodebuild
297
      (hit agree)
298
~~~~~~
299
300
You may subsequently need to build your first package with sudo in order to accept the Xcode licenses.
301
302
### Mountain Lion ### 
303
304 2 Redmine Admin
Same as Mavericks?
305 29 John Cary
306 1 Redmine Admin
### Mavericks ###
307
308
~~~~~~
309
sudo xcode-select --install
310
~~~~~~
311
312
313
## Java ##
314
315
(The below does not apply to yosemite.)
316 29 John Cary
317
The cmake build may fail due to missing java headers linked to in /System/Library/Frameworks/JavaVM.framework/Headers. To fix:
318 1 Redmine Admin
319
~~~~~~
320
cd /System/Library/Frameworks/JavaVM.framework/Headers
321
sudo mv jni.h jni.h.missing
322
~~~~~~