Project

General

Profile

Preparing a Mac machine for Bilder » History » Version 110

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