Project

General

Profile

Preparing a Mac machine for Bilder » History » Version 108

John Cary, 10/10/2024 10:34 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 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
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 11 Redmine Admin
## Java ##
138
139
You will need to install java by invoking the executable in any way such as...
140
141 1 Redmine Admin
~~~~~~
142
java -version
143 74 Tech-X Corporation
~~~~~~
144
145
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.)
146
147 1 Redmine Admin
Chose the macOS installer from
148
https://www.oracle.com/java/technologies/javase-jdk16-downloads.html
149 2 Redmine Admin
150 1 Redmine Admin
## HostName ##
151 31 John Cary
152 29 John Cary
For bilder to properly send emails the fully qualified hostname must set on the machine. To check this try...
153 1 Redmine Admin
154
~~~~~~
155
hostname -f
156
~~~~~~
157
158
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.
159
160
~~~~~~
161
sudo scutil --set ComputerName "machinename"
162
sudo scutil --set LocalHostName "machinename"
163
sudo scutil --set HostName "machinename.domainname.com"
164
dscacheutil -flushcache
165
~~~~~~
166
167
Restart your Mac after this.
168
169
## Power Saving Modes ##
170
171
For build machines that are not personal machines, disabling certain options will help in connectivity and responsiveness:
172
173
~~~~~~
174
Under Spotlight
175
 - disabled the main HD. (multiple mdworkers taking up a lot of cpu.)
176
~~~~~~
177
178
~~~~~~
179
Under Energy Saver
180
 - Computer sleep: Set to never
181
 - Unchecked Put hard disks to sleep when possible
182
 - Unchecked Wake for network access
183
~~~~~~
184 99 David Alexander
185
## Python ##
186
187
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.
188
189
190
191 1 Redmine Admin
192
&nbsp;
193
&nbsp;
194
&nbsp;
195
&nbsp;
196
&nbsp;
197
&nbsp;
198
&nbsp;
199 29 John Cary
&nbsp;
200
&nbsp;
201
&nbsp;
202
203 31 John Cary
---
204 1 Redmine Admin
205 31 John Cary
---
206
207 108 John Cary
208
# DEPRECATED INSTRUCTIONS #
209
210 31 John Cary
## X11 ##
211
212
X11 should not be needed, but if it is needed:
213
214
Install [XQuartz X11](http://xquartz.macosforge.org/landing/).
215
216
Create a symbolic link so that the X11 headers can be found by the compiler:
217
218
~~~~~~
219
sudo ln -s /opt/X11/include/X11 /usr/local/include/X11
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 30 John Cary
As of March 29, 2015, the version is 4.9.0.
241
242
The binaries will end up being installed in /usr/local/bin
243
244 11 Redmine Admin
245 1 Redmine Admin
## Git ##
246 10 Redmine Admin
247
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 11 Redmine Admin
250
### Macports ### 
251
252 10 Redmine Admin
This provides wget, freetype, and other utilities. Get macports from <http://www.macports.org/install.php> and install.
253 29 John Cary
254 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
255
256
~~~~~~
257 11 Redmine Admin
sudo xcode-select -switch /Applications/Xcode.app
258
~~~~~~
259 1 Redmine Admin
260
Otherwise, there will be an error installing zlib during the wget installation below.
261 29 John Cary
262
After the macports installation, do
263
264 1 Redmine Admin
~~~~~~
265
sudo port install wget
266
sudo port install ImageMagick +no_x11
267
sudo port install f2c
268
~~~~~~
269 11 Redmine Admin
270 1 Redmine Admin
271
### XCode ###
272
### Lion ###
273 2 Redmine Admin
274 1 Redmine Admin
On Lion, the command line compilers are not installed automatically. After installing Xcode, navigate to the 
275
Preferences->Download dialog 
276
and install the Command Line Tools. The dialog is.. 
277
278 11 Redmine Admin
!screenShotCommandLineTools.png!
279 29 John Cary
280
or from the command line do
281 1 Redmine Admin
282
~~~~~~
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 2 Redmine Admin
Same as Mavericks?
293 29 John Cary
294 1 Redmine Admin
### Mavericks ###
295
296
~~~~~~
297
sudo xcode-select --install
298
~~~~~~
299
300
301
## Java ##
302
303
(The below does not apply to yosemite.)
304 29 John Cary
305
The cmake build may fail due to missing java headers linked to in /System/Library/Frameworks/JavaVM.framework/Headers. To fix:
306 1 Redmine Admin
307
~~~~~~
308
cd /System/Library/Frameworks/JavaVM.framework/Headers
309
sudo mv jni.h jni.h.missing
310
~~~~~~