Project

General

Profile

Preparing a Mac machine for Bilder » History » Version 103

John Cary, 07/08/2024 06:05 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
` 
59
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 88 John Cary
Fortran comes with the homebrew gcc compiler. 
74
75 92 David Alexander
~~~~~~
76 88 John Cary
brew install gcc  # Intel architecture
77
~~~~~~
78 90 David Alexander
79 103 John Cary
The homebrew gcc compiler includes gfortran.
80 81 David Alexander
81 103 John Cary
Perhaps no longer needed:
82 100 David Alexander
~~~~~~
83 103 John Cary
brew install qt@5 # ARM only. Qt is version 5.15.10 as of 7/3/2023
84 39 David Alexander
~~~~~~
85
86
OPTIONAL:
87
88
If you receive an error regarding ruby version:
89
90
~~~~~~
91
brew install ruby@2.3
92
~~~~~~
93
94 1 Redmine Admin
may help.
95
96
97
## LaTeX ##
98 29 John Cary
99
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:
100 1 Redmine Admin
101 13 Redmine Admin
~~~~~~
102 1 Redmine Admin
setenv PATH /usr/texbin:${PATH}  # For tcsh
103
export PATH=/usr/texbin:${PATH}  # For bash
104 13 Redmine Admin
~~~~~~
105
106
For those who like GUIs, the !TeXworks in /Applications/TeX/TeXworks should work fine.
107 32 John Cary
108 13 Redmine Admin
For those with limited space, install BasicTeX from <https://tug.org/mactex/morepackages.html>. Add to your PATH:
109
110 32 John Cary
~~~~~~
111 1 Redmine Admin
    /usr/local/texlive/2017/bin/universal-darwin/
112 32 John Cary
~~~~~~
113 29 John Cary
114 32 John Cary
and then install the packages noted at
115 1 Redmine Admin
116
[[LaTeX packages needed by Bilder]]
117 32 John Cary
118
You may need to use sudo.
119 1 Redmine Admin
120 29 John Cary
~~~~~~
121 32 John Cary
sudo tlmgr update --self
122
sudo tlmgr install <needed packages>
123 1 Redmine Admin
~~~~~~
124
125
and then used the autoupdate feature to get any additionally needed packages.  This minimal installation is 230 M instead of the usual 2GB.
126
127
128
## Disable spindump ##
129
130
for faster compilations via
131
132 58 John Cary
~~~~~~
133
sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.spindump.plist
134 67 David Alexander
~~~~~~
135 97 John Cary
136 58 John Cary
## LLVM-Clang ##
137
138
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.
139
140 61 John Cary
We use homebrew to install this with
141 71 David Alexander
142 98 John Cary
~~~~~~
143 48 Nathan Neri
brew install llvm@15
144 44 Tech-X Corporation
~~~~~~
145 98 John Cary
146 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.
147
148
## Java ##
149
150
You will need to install java by invoking the executable in any way such as...
151
152 1 Redmine Admin
~~~~~~
153
java -version
154 74 Tech-X Corporation
~~~~~~
155
156
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.)
157
158 1 Redmine Admin
Chose the macOS installer from
159
https://www.oracle.com/java/technologies/javase-jdk16-downloads.html
160 2 Redmine Admin
161 1 Redmine Admin
## HostName ##
162 31 John Cary
163 29 John Cary
For bilder to properly send emails the fully qualified hostname must set on the machine. To check this try...
164 1 Redmine Admin
165
~~~~~~
166
hostname -f
167
~~~~~~
168
169
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.
170
171
~~~~~~
172
sudo scutil --set ComputerName "machinename"
173
sudo scutil --set LocalHostName "machinename"
174
sudo scutil --set HostName "machinename.domainname.com"
175
dscacheutil -flushcache
176
~~~~~~
177
178
Restart your Mac after this.
179
180
## Power Saving Modes ##
181
182
For build machines that are not personal machines, disabling certain options will help in connectivity and responsiveness:
183
184
~~~~~~
185
Under Spotlight
186
 - disabled the main HD. (multiple mdworkers taking up a lot of cpu.)
187
~~~~~~
188
189
~~~~~~
190
Under Energy Saver
191
 - Computer sleep: Set to never
192
 - Unchecked Put hard disks to sleep when possible
193
 - Unchecked Wake for network access
194
~~~~~~
195 99 David Alexander
196
## Python ##
197
198
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.
199
200
201
202 1 Redmine Admin
203
&nbsp;
204
&nbsp;
205
&nbsp;
206
&nbsp;
207
&nbsp;
208
&nbsp;
209
&nbsp;
210 29 John Cary
&nbsp;
211
&nbsp;
212
&nbsp;
213
214 31 John Cary
---
215 1 Redmine Admin
216 31 John Cary
---
217
218
## X11 ##
219
220
X11 should not be needed, but if it is needed:
221
222
Install [XQuartz X11](http://xquartz.macosforge.org/landing/).
223
224
Create a symbolic link so that the X11 headers can be found by the compiler:
225
226 1 Redmine Admin
~~~~~~
227 31 John Cary
sudo ln -s /opt/X11/include/X11 /usr/local/include/X11
228
~~~~~~
229
230
# DEPRECATED INSTRUCTIONS #
231
232
233
## Other gfortran options (besides HomeBrew) ##
234
235
### Option 2: HPC ###
236
237
Install gfortran from [SourceForge HPC](http://hpc.sourceforge.net).  (Do not also install the other gcc compilers.)
238
239
As of March 29, 2015, the version is 4.9.0.
240
241
Install via
242
243
~~~~~~
244
$ tar xzf gfortran-4.9-bin.tar.gz -C /
245
~~~~~~
246
247
### Option 3: GNU ###
248
249
Install gfortran using the installer from <http://gcc.gnu.org/wiki/GFortranBinaries>.
250
251 30 John Cary
As of March 29, 2015, the version is 4.9.0.
252
253
The binaries will end up being installed in /usr/local/bin
254
255 11 Redmine Admin
256 1 Redmine Admin
## Git ##
257 10 Redmine Admin
258
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.
259
260 11 Redmine Admin
261
### Macports ### 
262
263 10 Redmine Admin
This provides wget, freetype, and other utilities. Get macports from <http://www.macports.org/install.php> and install.
264 29 John Cary
265 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
266
267
~~~~~~
268 11 Redmine Admin
sudo xcode-select -switch /Applications/Xcode.app
269
~~~~~~
270 1 Redmine Admin
271
Otherwise, there will be an error installing zlib during the wget installation below.
272 29 John Cary
273
After the macports installation, do
274
275 1 Redmine Admin
~~~~~~
276
sudo port install wget
277
sudo port install ImageMagick +no_x11
278
sudo port install f2c
279
~~~~~~
280 11 Redmine Admin
281 1 Redmine Admin
282
### XCode ###
283
### Lion ###
284 2 Redmine Admin
285 1 Redmine Admin
On Lion, the command line compilers are not installed automatically. After installing Xcode, navigate to the 
286
Preferences->Download dialog 
287
and install the Command Line Tools. The dialog is.. 
288
289 11 Redmine Admin
!screenShotCommandLineTools.png!
290 29 John Cary
291
or from the command line do
292 1 Redmine Admin
293
~~~~~~
294
sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer/
295
xcodebuild
296
      (hit agree)
297
~~~~~~
298
299
You may subsequently need to build your first package with sudo in order to accept the Xcode licenses.
300
301
### Mountain Lion ### 
302
303 2 Redmine Admin
Same as Mavericks?
304 29 John Cary
305 1 Redmine Admin
### Mavericks ###
306
307
~~~~~~
308
sudo xcode-select --install
309
~~~~~~
310
311
312
## Java ##
313
314
(The below does not apply to yosemite.)
315 29 John Cary
316
The cmake build may fail due to missing java headers linked to in /System/Library/Frameworks/JavaVM.framework/Headers. To fix:
317 1 Redmine Admin
318
~~~~~~
319
cd /System/Library/Frameworks/JavaVM.framework/Headers
320
sudo mv jni.h jni.h.missing
321
~~~~~~