Project

General

Profile

Preparing a Mac machine for Bilder » History » Version 109

John Cary, 11/03/2024 05:23 PM

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