Project

General

Profile

Preparing a Mac machine for Bilder » History » Version 98

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