-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathosx.t2t
955 lines (674 loc) · 29.6 KB
/
osx.t2t
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
= Building on MacOS X =
In this approach I will try to avoid as much as possible building dependencies
from source and rather use frameworks wherever possible.
"Universal", SDK and non-default arch builds require more complex options and
some fiddling with the system. It is best to stick with a single, default,
architecture build and follow these instructions for an initial build.
Included are notes for building on Mac OS X 10.5 (__Leopard__), 10.6
(__Snow Leopard__), 10.7 (__Lion__), 10.8 (__Mt. Lion__) and 10.9 (__Mavericks__)
(These names will be used throughout the instructions.)
Make sure to read each section completely before typing the first command you see.
__General note on Terminal usage:__ When I say "cd" to a folder in a Terminal,
it means type "cd " (without the quotes, make sure to type a space after) and
then type the path to said folder, then <return>. A simple way to do this
without having to know and type the full path is, after type the "cd " part,
drag the folder (use the icon in its window title bar, or drag a folder from
within a window) from the Desktop to the Terminal, then tap <return>.
__Parallel Compilation:__ On multiprocessor/multicore Macs, it's possible to
speed up compilation, but it's not automatic. Whenever you type "make" (but
NOT "make install"), instead type:
```
make -j [#cpus]
```
Replace [#cpus] with the number of cores and/or processors your Mac has. On recent
models with hyperthreading processors this can be double the physical count of
processors and cores.
ie: Mac Pro "8 Core" model (2 quad core processors) = 8
ie: Macbook Pro i5 (hyperthreading) = 2 cores X 2 = 4
To find out how many CPUs you have available, run the following in Terminal:
```
/usr/sbin/sysctl -n hw.ncpu
```
which can be used in build shell scripts like:
```
make -j $(/usr/sbin/sysctl -n hw.ncpu)
```
__Note:__ if you get an error in parallel compilation, try removing the -j # flag,
so it's just 'make', or using a smaller number. Sometimes make can hiccup on too
many threads.
== Install Developer Tools ==
Developer tools are not a part of a standard OS X installation. Up through
Snow Leopard, the Developer Tools, later called Xcode, were included with the
system install disks, though it's best to download the latest version compatible
with your system to get important updates fixing various issues.
Starting with Lion, Xcode is available as a download and from the App Store.
Downloading Xcode/Developer Tools for up through Snow Leopard requires a free developer account at
developer.apple.com. Up through Snow Leopard, get the latest __Xcode__ that is
supported for your system. For Lion and above, you can get Xcode from either a
free developer account or for a minimal fee from the app store.
When installing Xcode up through Snow Leopard, make sure to
do a custom install and install the Unix Development or Command Line Tools option.
On Lion, if you have installed Xcode 4.0 - 4.2 and are upgrading to 4.3, it's
a good idea to uninstall the old version first with:
```
sudo /Developer/Library/uninstall-devtools
```
On Lion and Mt. Lion, using Xcode 4.4+, the developer command line tools can be
installed via the Xcode preferences.
Xcode 4.3+ also introduces the clang frontend to the LLVM compiler as default.
**Note:** In XCODE 4.5 installed from the app store, you need to install the
command line tools from XCode -> Preferences -> Downloads and choose command line tools.
http://clang.llvm.org/
The supplied clang version 4 can compile QGIS, but presents many warnings
compared to just using LLVM. You can specifically use LLVM by exporting paths to
the compilers in Terminal, or shell scripts, prior to building QGIS:
```
export CC=/usr/bin/llvm-gcc
export CXX=/usr/bin/llvm-g++
```
If you have trouble building some of the dependencies listed below with clang
(e.g. OSG & osgEarth), try using only the LLVM compilers.
== Install Qt4 from disk image ==
You need a minimum of Qt-4.4.0. I suggest getting the latest (Qt 4, not 5). There is no need
for the full Qt SDK, so save yourself some download time and get the frameworks
only. This is available in the Libraries section of the Qt download page.
__Snow Leopard+ note:__ If you are building on Snow Leopard+, you will need to
decide between 32-bit support in the older Qt Carbon branch, or 64-bit
support in the Qt Cocoa branch. Appropriate installers are available for both
as of Qt-4.5.2, though they stopped making Carbon packages at Qt 4.7.4.
Qt 4.6+ is recommended for Cocoa.
Starting with Lion, Carbon may not work properly, if at all.
Starting with Qt 4.8, only 64bit Cocoa installers are available.
__General note:__ Support for new system versions in any given Qt version may
not be present and may cause a 'This version of Mac OS X
is unsupported' error when building QGIS. Try the next Qt version.
__PPC note:__ The readymade Qt Cocoa installers don't include PPC support, you'd
have to compile Qt yourself. But, there appear to be issues with Qt Cocoa on
PPC Macs anyways. Qt Carbon is recommended on PPC Macs.
http://qt-project.org/downloads
If you want debug frameworks, Qt also provides a separate download with these.
These are in addition to the non-debug frameworks.
Earlier OS X systems may need an old Qt version - check the requirements of the
current Qt version. To get old Qt downloads, there is an FTP link at the bottom
of the download page. Files are in the qt/source (yes, even the binary packages).
Once downloaded open the disk image and run the installer. Note you need admin
privileges to install.
__Leopard+ note:__ Qt includes a couple non-framework libraries in /usr/lib.
When using a system SDK these libraries will not be found. To fix this problem,
add symlinks to /usr/local:
```
sudo ln -s /usr/lib/libQtUiTools.a /usr/local/lib/
sudo ln -s /usr/lib/libQtCLucene.dylib /usr/local/lib/
```
These should then be found automatically. Earlier systems
may need some help by adding '-L/usr/local/lib' to CMAKE_SHARED_LINKER_FLAGS,
CMAKE_MODULE_LINKER_FLAGS and CMAKE_EXE_LINKER_FLAGS in the cmake build.
== Install CMake for OSX ==
Get the latest source release from here:
http://www.cmake.org/cmake/resources/software.html
Binary installers are available for OS X, but they are not recommended
(2.4 versions install in /usr instead of /usr/local, and 2.6+ versions are a
strange application). Instead, download the source.
NOTE: 2.8.5 is broken for detecting part of Qt. Fixed in 2.8.6.
Double-click the source tarball to unpack it, then cd to the source folder and:
```
./bootstrap --docdir=/share/doc/CMake --mandir=/share/man
make -j [#cpus]
sudo make install
```
=== Optional setup: ccache ===
__Xcode 4.4+ note:__ You will probably not need to install ccache if you are using
the clang frontend to LLVM compiler, a setup that already provides fairly quick
compile times.
Setup ccache to significantly speed up compile times after initial build.
(Switching git branches will again cause longer initial build times unless
separate build directories are used for each branch.)
Get the latest source release from here:
http://ccache.samba.org/
Double-click the source tarball to unpack, then, in Terminal.app, cd to the
source folder and:
```
./configure
make
sudo make install
```
After install, symbolically link compilers to /usr/local/bin/ccache.
(Note: this differs from instructions at http://ccache.samba.org/manual.html
Changing the /usr/bin:/usr/local/bin order in PATH is not recommended on OS X.
```
sudo mkdir /usr/local/bin/compilers && cd /usr/local/bin/compilers
sudo ln -s ../ccache gcc
sudo ln -s ../ccache g++
sudo ln -s ../ccache cc
sudo ln -s ../ccache c++
```
Add the following to the end of your ~/.bash_profile (and optionally ~/.bashrc)
to allow your login shell to discover the symbolically linked compilers before
/usr/bin compilers and to easily toggle using ccache off, by commenting out the
line and starting a new login session in Terminal.
```
export PATH=/usr/local/bin/compilers:$PATH
```
If you have trouble building some of the dependencies listed below (e.g. OSG &
osgEarth), try bypassing ccache.
== Install development frameworks for QGIS dependencies ==
Download William Kyngesburye's excellent GDAL Complete package that includes
PROJ, GEOS, GDAL, SQLite3, SpatiaLite, and image libraries, as frameworks.
There are also GSL and FreeType frameworks.
http://www.kyngchaos.com/software/frameworks
Once downloaded, open and install the frameworks.
William provides an additional installer package for PostgreSQL (for PostGIS
support). QGIS just needs the libpq client library, so unless you want to
setup the full Postgres + PostGIS server, all you need is the client-only
package. It's available here:
http://www.kyngchaos.com/software/postgres
Also available is a GRASS application:
http://www.kyngchaos.com/software/grass
Old versions of these packages for older systems are available in the
software archive section.
=== Additional dependencies: General compatibility note ===
There are some additional dependencies that, at the time of writing, are not
provided as frameworks or installers so we will need to build these from source.
If you are wanting to build QGIS as a 64-bit application, you will need to
provide the appropriate build commands to produce 64-bit support in dependencies.
Likewise, for 32-bit support on Snow Leopard, you will need to override the
default system architecture, which is 64-bit, according to instructions for
individual dependency packages.
Stable release versions are preferred. Beta and other development versions may
have problems and you are on your own with those.
=== Additional dependencies: Expat ===
__Snow Leopard+ note:__ Snow Leopard includes a usable expat, so this step is
not necessary on Snow Leopard or above.
Get the expat sources:
http://sourceforge.net/project/showfiles.php?group_id=10127
Double-click the source tarball to unpack, then, in Terminal.app, cd to the
source folder and:
```
./configure
make
sudo make install
```
=== Additional dependencies: Spatialindex ===
Get the libspatialindex sources:
http://download.osgeo.org/libspatialindex/
Double-click the source tarball to unpack, then, in Terminal.app, cd to the
source folder and:
```
./configure --disable-dependency-tracking CFLAGS=-Os
make
sudo make install
```
=== Additional dependencies: Python ===
__Leopard+ note:__ Starting with Leopard a usable Python is included
in the system. This is Python 2.5, 2.6 and 2.7, respectively for Leo, Snow and Lion+.
So there is no need to install Python on Leopard and newer.
You can still install Python from python.org if preferred.
If installing from python.org, make sure you install the latest Python
2.x from
http://www.python.org/download/
Python 3 is a major change, and may have compatibility issues, so try it at
your own risk.
=== Additional dependencies: SIP ===
__Mt Lion note:__ SIP 4.15.7 appears to not work on Mt Lion. Install either
a prior version to 4.14.6 or a later version 4.16.3+
Retrieve the python bindings toolkit SIP from
http://www.riverbankcomputing.com/software/sip/download
Double-click the source tarball to unpack it, then, in Terminal.app,
cd to the source folder. Then for your chosen Python:
__python.org Python__
```
python configure.py
make
sudo make install
```
__Leopard system Python__
SIP wants to install in the system path -- this is not a good idea.
More configuration is needed to install outside the system path:
```
python configure.py -n -d /Library/Python/2.5/site-packages -b /usr/local/bin \
-e /usr/local/include -v /usr/local/share/sip -s MacOSX10.5.sdk
```
__Snow Leopard system Python__
Similar to Leopard, you should install outside the system Python path.
Also, you need to specify the architecture you want and make sure to run the
versioned python binary (this one responds to the 'arch' command, 'python' does
not). Substitute '2.7' for python version and 10.7 for SDK version below for
Lion.
If you are using 32-bit Qt (Qt Carbon):
```
python2.6 configure.py -n -d /Library/Python/2.6/site-packages -b /usr/local/bin \
-e /usr/local/include -v /usr/local/share/sip --arch=i386 -s MacOSX10.6.sdk
```
For 64-bit Qt (Qt Cocoa), use this configure line:
```
python2.6 configure.py -n -d /Library/Python/2.6/site-packages -b /usr/local/bin \
-e /usr/local/include -v /usr/local/share/sip --arch=x86_64 -s MacOSX10.6.sdk
```
__Lion+ system Python__
Similar to Snow Leopard, you should install outside the system Python path.
The SDK option should match the system you are compiling on:
for Lion:
```
python2.7 configure.py -d /Library/Python/2.7/site-packages -b /usr/local/bin \
-e /usr/local/include -v /usr/local/share/sip --arch=x86_64 -s MacOSX10.7.sdk
```
for Mt. Lion:
```
python2.7 configure.py -d /Library/Python/2.7/site-packages -b /usr/local/bin \
-e /usr/local/include -v /usr/local/share/sip --arch=x86_64 -s MacOSX10.8.sdk
```
for Mavericks:
```
python2.7 configure.py -d /Library/Python/2.7/site-packages -b /usr/local/bin \
-e /usr/local/include -v /usr/local/share/sip --arch=x86_64 -s MacOSX10.9.sdk
```
__continue...__
Then continue with compilation and installation:
```
make
sudo make install
```
=== Additional dependencies: QScintilla2 ===
Retrieve the Qt version of the Scintilla-based text editor widget from
http://www.riverbankcomputing.co.uk/software/qscintilla/download
Double-click the tarball to unpack it. Then, cd to the QScintilla2.x.x source
folder in a Terminal.
QScintilla2 wants to install in the system path -- with libraries going into
/Library/Frameworks and headers into /usr/include/Qsci -- this is not a good
idea, and it also basically breaks the QtDesigner plugin. More configuration
is needed to install outside the system path, in /usr/local/:
```
cd Qt4Qt5
```
Edit QScintilla-gpl-2.x.x/Qt4Qt5/qscintilla.pro in the following manner:
```
current line --> new line
target.path = $$[QT_INSTALL_LIBS] --> target.path = /usr/local/lib
header.path = $$[QT_INSTALL_HEADERS] --> header.path = /usr/local/include
```
Save the qscintilla.pro file and build the QScintilla2 C++ library:
```
qmake -spec macx-g++ qscintilla.pro
make -j [#cpus]
sudo make install
```
adjust the install_name_tool command for the version installed of QScintilla installed:
```
sudo install_name_tool -id /usr/local/lib/libqscintilla2.11.dylib \
/usr/local/lib/libqscintilla2.11.dylib
```
This installs QScintilla2's dylib in /usr/local/lib/ and the header files in
/usr/local/include/Qsci/, both of which should be automatically found when
building QGIS.
==== Optional setup: QScintilla2 QtDesigner plugin ====
The plugin allows QScintilla2 widgets to be used within QtDesigner.
```
cd <QScintilla2 source directory>
cd designer-Qt4Qt5
qmake -spec macx-g++ designer.pro
make
sudo make install
```
Installs in /Developer/Applications/Qt/plugins/designer/
=== Additional dependencies: PyQt ===
Retrieve the python bindings toolkit for Qt from
http://www.riverbankcomputing.com/software/pyqt/download
Double-click the source tarball to unpack it, then, in Terminal.app,
cd to the source folder. Then for your chosen Python:
__python.org Python__
```
python configure.py -n /usr/local/Qt4.8/qsci
yes
```
__Leopard system Python__
PyQt wants to install in the system path -- this is not a good idea.
More configuration is needed to install outside the system path:
```
python configure.py -d /Library/Python/2.5/site-packages -b /usr/local/bin -n /usr/local/Qt4.8/qsci -v /usr/local/share/sip/PyQt4
```
__Snow Leopard system Python__
Similar to Leopard, you should install outside the system Python path.
Also, you need to specify the architecture you want (requires at least PyQt 4.6),
and make sure to run the versioned python binary (this one responds to the
'arch' command, which is important for pyuic4, 'python' does not).
Substitute '2.7' for python version and 10.7 for SDK version below for Lion.
If you are using 32-bit Qt (Qt Carbon):
```
python2.6 configure.py -d /Library/Python/2.6/site-packages -b /usr/local/bin \
-n /usr/local/Qt4.8/qsci -v /usr/local/share/sip/PyQt4 --use-arch i386
```
For 64-bit Qt (Qt Cocoa), use this configure line:
```
python2.6 configure.py -d /Library/Python/2.6/site-packages -b /usr/local/bin \
-n /usr/local/Qt4.8/qsci -v /usr/local/share/sip/PyQt4 --use-arch x86_64
```
__Lion, Mt. Lion, and Mavericks system Python__
Similar to Snow Leopard, you should install outside the system Python path.
But you don't need the use-arch option:
```
python2.7 configure.py -d /Library/Python/2.7/site-packages -b /usr/local/bin -n /usr/local/Qt4.8/qsci -v /usr/local/share/sip/PyQt4
```
__continue...__
```
make -j [#cpus]
sudo make install
```
If there is a problem with undefined symbols in QtOpenGL on Leopard, edit
QtOpenGL/makefile and add ""-undefined dynamic_lookup"" to LFLAGS.
Then make again.
=== Additional dependencies: QScintilla2 Python Module ===
This will create the Qsci.so module in /Library/Python/2.x/site-packages/PyQt4.
Like PyQt, it needs help to not install in system locations.
__Snow Leopard:__ substitute '2.6' for Python version
```
cd <QScintilla2 source dir>
cd Python
python2.7 configure.py -o /usr/local/lib -n /usr/local/include \
-d /Library/Python/2.7/site-packages/PyQt4 -v /usr/local/share/sip/PyQt4 \
--sip-incdir=/usr/local/include --pyqt-sipdir=/usr/local/share/sip/PyQt4
cat >>Qsci.pro <<EOF
QMAKE_LFLAGS_PLUGIN -= -dynamiclib
QMAKE_LFLAGS_PLUGIN += -bundle
EOF
qmake -spec macx-g++ Qsci.pro
make -j [#cpus]
sudo make install
```
The -o and -n options should match the QScintilla2 C++ dylib install options.
=== Additional dependencies: Qwt ===
The GPS tracking feature uses Qwt.
NOTE: PyQwt is not compatible with PyQt 4.9, so we will skip that.
Download the latest Qwt 6.0 source (6.1 does not work with the QwtPolar in QGIS) from:
http://sourceforge.net/projects/qwt
Double-click the tarball to unpack it. Now, cd to the qwt source folder in a
Terminal.
Type these commands to build and install 6.0.x (assumes v6.0.2, adjust commands
for other version as needed):
```
cat >> qwtconfig.pri <<EOF
QWT_CONFIG -= QwtFramework
EOF
qmake -spec macx-g++
make -j [#cpus]
sudo make install
sudo install_name_tool -id /usr/local/qwt-6.0.2/lib/libqwt.6.dylib \
/usr/local/qwt-6.0.2/lib/libqwt.6.dylib
```
The Qwt shared library is now installed in /usr/local/qwt-6.0.x (x is
the point version). Remember this for QGIS configuration.
=== Additional dependencies: Bison ===
The version of bison available by default on Mac OS X is too old so you
need to get a more recent one on your system. Download at least version 2.4 from:
```
ftp.gnu.org/gnu/bison/
```
Now build and install it to a prefix of /usr/local. Double-click the source
tarball to unpack it, then cd to the source folder and:
```
./configure --disable-dependency-tracking CFLAGS=-Os
make
sudo make install
```
=== Additional dependencies: gpsbabel ===
For integrated GPS Tools functions, a gpsbabel executable is required. You can
find this at:
http://www.gpsbabel.org/
Download the GPSBabel OS X package, and copy GPSBabelFE.app from the disk image to
/Applications.
=== Optional dependencies: libfcgi ===
If you want to use the QGIS Mapserver, you need libfcgi. This is included on
systems up through Snow Leopard, but was dropped at Lion. So, on Lion you need
to get the source from:
http://www.fastcgi.com/dist/
Grab the latest fcgi SNAP package there. Double-click the source
tarball to unpack it, then cd to the source folder and:
```
./configure --disable-dependency-tracking CFLAGS=-Os
make
sudo make install
```
=== Optional dependencies: OSG & osgEarth ===
If you want the Globe plugin in QGIS (default OFF), OSG and osgEarth are needed.
First, **OpenSceneGraph**. The main site is very out of date, just go to
github:
http://github.com/openscenegraph/osg/tags
Download the latest 3.1 version (you can select a tarball when you hover over
the entry). Double-click the source tarball to unpack it.
(There is a version numbering oddity in the source, but since we'll be
bundling OSG as it's meant to be, it really doesn't matter).
Installation is a bit out of touch with OS X standards, so we'll stage it to a
temporary location first. You could stage it to the folder that the OSG source
folder is in, or a common staging area like /Users/Shared/unix/osg. Pick a
folder not hidden and that doesn't need admin permissions to write to for simplicity.
If you are building on Leopard, its configure forces a old ppc/i386 32bit build.
If you want 64bit you need to fix CMakeLists.txt - in a text editor, find the
if-block that starts with:
```
ELSEIF(${OSG_OSX_SDK_NAME} STREQUAL "macosx10.6" OR ${OSG_OSX_SDK_NAME} STREQUAL "macosx10.5")
```
In that section before the next ELSEIF, change:
```
ppc;i386
```
to:
```
i386;x86_64
```
and change:
```
mmacosx-version-min=10.5
```
to:
```
mmacosx-version-min=10.6
```
In a new Terminal cd to the source folder and:
```
mkdir build
cd build
cmake -D CMAKE_INSTALL_PREFIX=/path/to/some/staging/folder \
-D OSG_COMPILE_FRAMEWORKS=ON \
-D OSG_PLUGIN_SEARCH_INSTALL_DIR_FOR_PLUGINS=OFF \
-D JASPER_LIBRARY=/Library/Frameworks/UnixImageIO.framework \
-D JASPER_INCLUDE_DIR=/Library/Frameworks/UnixImageIO.framework/Headers \
-D TIFF_LIBRARY=/Library/Frameworks/UnixImageIO.framework \
-D TIFF_INCLUDE_DIR=/Library/Frameworks/UnixImageIO.framework/Headers \
..
make
make install
sudo mkdir -p "/Library/Application Support/OpenSceneGraph/PlugIns"
```
Open the staging folder you chose for the CMAKE_INSTALL_PREFIX option above.
Now move all .frameworks from the lib/ folder in the staging area to /Library/Frameworks. Move the files in the osgPlugins folder in the lib/ folder
to /Library/Application Support/OpenSceneGraph/PlugIns. The bin/ executables
can be left where they are.
Next up is **libzip**. Get the latest tarball at:
http://nih.at/libzip/
Double-click the source tarball to unpack it.
In a new Terminal cd to the source folder and:
```
./configure --disable-dependency-tracking --disable-shared CFLAGS=-Os
make
sudo make install
```
Then it's time for **osgEarth**. Downloads are also on github:
http://github.com/gwaldron/osgearth/tags
Download a tarball for the latest stable release (sorting can be confusing here).
Double-click the source tarball to unpack it.
__Note:__ for now stick with version 2.3. There are compile errors in 2.4 that need attention.
This one also needs an intermediate staging area. Choose a folder similar to OSG.
In a new Terminal cd to the source folder and:
```
mkdir build
cd build
export PATH="/path/to/osg/staging/folder/bin:$PATH"
cmake -D CMAKE_INSTALL_PREFIX=/path/to/some/staging/folder \
-D CMAKE_BUILD_TYPE=MinSizeRel \
-D OSGEARTH_BUILD_FRAMEWORKS=true \
..
make
make install
sudo mkdir -p "/Library/Application Support/OpenSceneGraph/Headers"
```
Open the staging folder you chose for the CMAKE_INSTALL_PREFIX option above.
Also open the OSG staging path /bin folder from the OSG build.
Move all the .frameworks from the lib/ folder to /Library/Frameworks.
Move the files in the osgPlugins folder in the lib/ folder to
/Library/Application Support/OpenSceneGraph/PlugIns. Move the osgEarthDrivers
folder in the include/ folder to /Library/Application Support/OpenSceneGraph/Headers.
(you may need to create this folder)
And as for OSG, you can leave the bin/ executables where they are.
== API documentation ==
If you want to build a local copy of the API docs (like those at
http://doc.qgis.org/api) you will need Graphviz and Doxygen installed:
http://www.graphviz.org/Download_macos.php
http://www.stack.nl/~dimitri/doxygen/download.html
Graphviz is simply installed via a regular Mac package installer. Install it
first. It will place some of its binaries in /usr/local/bin/.
For Doxygen, compiling the source is recommended over installing the app.
Double-click the source tarball to unpack it, then cd to the source folder and:
```
./configure
make -j [#cpus]
sudo make install
```
The documentation will be output to the build directory, and if using more complete
QGIS.app bundling on install, inside the app in:
QGIS.app/Contents/Resources/doc
== QGIS source ==
Unzip the QGIS source tarball to a working folder of your choice
(/usr/somewhere is not a good choice as it's hidden and requires root
privileges). If you are reading this from the source, you've already done
this.
If you want to experiment with the latest development sources, go to the github
QGIS project page:
http://github.com/qgis/QGIS
It should default to the master branch. Click the __Downloads__ button and
select __Download .tar.gz__. Double-click the tarball to unzip it.
//Alternatively//, install git from http://git-scm.com and do the following.
Make a specific repository directory somewhere, e.g. ~/QGIS/QGIS, and cd
into it. The following will read-only clone the master branch to the directory:
```
git init
git remote add -f -t master -m master qgisupstream git://github.com/qgis/QGIS.git
git merge qgisupstream
```
== Configure the build ==
CMake supports out of source build so we will create a 'build' dir for the
build process. OS X uses ${HOME}/Applications as a standard user app folder (it
gives it the system app folder icon). If you have the correct permissions you
may want to build straight into your /Applications folder. The instructions
below assume you are building into a ${HOME}/Applications directory.
You have two interactive options for configuring the build: ccmake or run
Terminal commands. ccmake is a curses interface inside Terminal for CMake and
allows a tabular layout for viewing and editing ALL available QGIS source CMake
options. To get started initially run the Terminal method.
In a Terminal cd to the qgis source folder previously downloaded, then:
```
mkdir build
cd build
cmake -D CMAKE_INSTALL_PREFIX=~/Applications \
-D CMAKE_BUILD_TYPE=MINSIZEREL -D ENABLE_TESTS=FALSE \
-D SPATIALINDEX_LIBRARY=/usr/local/lib/libspatialindex.dylib \
-D SPATIALINDEX_INCLUDE_DIR=/usr/local/include/spatialindex \
-D QWT_LIBRARY=/usr/local/qwt-6.0.2/lib/libqwt.dylib \
-D QWT_INCLUDE_DIR=/usr/local/qwt-6.0.2/include \
-D BISON_EXECUTABLE=/usr/local/bin/bison \
..
```
__Note:__ Don't forget the .. on the last line, which tells CMake to look for the
source files in one directory up.
After the initial Terminal configure, you can use ccmake to make further changes:
```
cd build
ccmake ..
```
This will automatically find and use the previously installed frameworks, and
the GRASS application if installed. Remember to change the Qwt version if a
different version was installed, and possibly paths, e.g. for Qwt 6.0.2 installed
as a framework use:
```
-D QWT_LIBRARY=/usr/local/qwt-6.0.2/lib/qwt.framework/qwt \
-D QWT_INCLUDE_DIR=/usr/local/qwt-6.0.2/lib/qwt.framework/Headers \
```
If you want to use a newer PostgreSQL client than the default Mac OS X version,
e.g. install from kyngchaos.com, set the following option to pg_config's path:
```
-D POSTGRES_CONFIG=/usr/local/pgsql/bin/pg_config \
```
To build a local copy of the API docs (see API documentation section above):
```
-D WITH_APIDOC=TRUE \
```
__Snow Leopard note:__ To handle 32-bit Qt (Carbon), create a 32bit python wrapper
script and add arch flags to the configuration:
```
sudo cat >/usr/local/bin/python32 <<EOF
#!/bin/sh
exec arch -i386 /usr/bin/python2.6 \${1+"\$@"}
EOF
sudo chmod +x /usr/local/bin/python32
cmake -D CMAKE_INSTALL_PREFIX=~/Applications \
-D CMAKE_BUILD_TYPE=MINSIZEREL -D ENABLE_TESTS=FALSE \
-D WITH_INTERNAL_SPATIALITE=FALSE -D WITH_PYSPATIALITE=FALSE \
-D SPATIALINDEX_LIBRARY=/usr/local/lib/libspatialindex.dylib \
-D SPATIALINDEX_INCLUDE_DIR=/usr/local/include/spatialindex \
-D QWT_LIBRARY=/usr/local/qwt-5.2.2/lib/libqwt.dylib \
-D QWT_INCLUDE_DIR=/usr/local/qwt-5.2.2/include \
-D BISON_EXECUTABLE=/usr/local/bin/bison \
-D CMAKE_OSX_ARCHITECTURES=i386 -D PYTHON_EXECUTABLE=/usr/local/bin/python32 \
..
```
__Mapserver note:__ The QGIS Mapserver feature requires fastcgi support. This is included in
Leopard and Snow Leopard, but was dropped at Lion. To build the Mapserver
component on Leopard and Snow, add the following line before the last line in
the above configuration:
```
-D WITH_SERVER=TRUE \
```
On Lion you are on your own to figure out how to install libfcgi and add fcgi
support to the system Apache. Not recommended for the average user.
__Globe plugin note:__ If you want the Globe plugin (and you compiled and installed OSG/osgEarth),
add the following lines before the last line in the above configuration:
```
-D WITH_GLOBE=true \
-D OSGEARTH_INCLUDE_DIR="/Library/Application Support/OpenSceneGraph/Headers" \
-D OSG_PLUGINS_PATH="/Library/Application Support/OpenSceneGraph/PlugIns" \
```
__Bundling note:__ Older Qt versions may have problems with some Qt plugins and
QGIS. The way to handle this is to bundle Qt inside the QGIS application. The
default is to bundle Qt (and osg/osgEarth, if configured).
Even better for distribution purposes, to also bundle any extra non-framework,
non-standard, libs (ie postgres' libpq) set the bundle value to 2:
```
-D QGIS_MACAPP_BUNDLE=2 \
```
== Building ==
Now we can start the build process (remember the parallel compilation note at
the beginning, this is a good place to use it, if you can):
```
make -j [#cpus]
```
If all built without errors you can then install it:
```
make install
```
or, for an /Applications build:
```
sudo make install
```
== Post-Install ==
A couple things to take care of.
**gpsbabel**
For QGIS to //easily// find gpsbabel, you need to copy the gpsbabel executable
to the QGIS application. Assuming you installed QGIS in your home folder:
```
cp -fp /Applications/GPSBabelFE.app/Contents/MacOS/gpsbabel ~/QGIS.app/Contents/MacOS/bin/
```
If you installed in /Applications, adjust the path accordingly and prefix the
whole command with 'sudo '.
**QGIS Server**
See the QGIS Server documentation page at:
http://docs.qgis.org/2.18/en/docs/user_manual/working_with_ogc/ogc_server_support.html
for instructions on setting up Apache fastcgi and testing qgis server, including
installing the mod-fastcgi that is missing on Lion.