1GMTSWITCH(1) GMT GMTSWITCH(1)
2
3
4
6 gmtswitch - Switching between different GMT versions
7
9 gmtswitch [ D | version ]
10
12 gmtswitch helps you modify your environment to allow for the switching
13 back and forth between several installed GMT versions, in particular
14 GMT 5 and versions from the GMT 4 series. It works by maintaining a
15 list of directories to GMT installations in a file in your home direc‐
16 tory, then manipulates a symbolic link to point to the GMT directory
17 whose executables we wish to use [The Windows version works a bit dif‐
18 ferently; see WINDOWS below].
19
21 None. If no arguments are given you are presented with a menu of
22 installed GMT versions from 1 to n and you specify which one you wish
23 to switch to.
24
26 D Select the default GMT version. This is the first entry in the
27 ~/.gmtversions file
28
29 version
30 Search for a unique match in the ~/.gmtversions file. If one
31 match is found we switch to that entry; otherwise an error is
32 generated. where module is the name of a GMT program and the
33 options are those that pertain to that particular program.
34
36 If you have official versions installed then running gmtswitch the very
37 first time will examine your hard disk starting at / and look for
38 directories with GMT4 or GMT5 in the name. This will fail to find the
39 subversion directories and possibly others you have placed elsewhere.
40 The fastest way to get up and running is this:
41
42 1.
43
44 Edit/Create ~/.gmtversions and add the paths to all GMT installa‐
45 tions
46 you have or care to consider. Each path goes on separate
47 lines and points to the top dir of each distribution, e.g.,
48 /Users/pwessel/UH/RESEARCH/PROJECTS/GMTdev/GMT4.5.7
49
50 2.
51
52 In your .bashrc or .[t]csrh or wherever you are maintaining your
53 PATH
54 or path variable, remove any directories you have added that
55 contain GMT, and add the new path $HOME/this_gmt/bin (might
56 be $home for csh users). Make sure this path appears before
57 any others that might contain a GMT installation, such as
58 those used by package managers (e.g., /sw/bin for fink,
59 /opt/local/bin for Macports, etc.).
60
61 3. Make the new path take effect (quit/restart terminal, logout/login,
62 etc).
63
64 4.
65
66 cd to the most recent GMT directory where a gmtswitch version lives,
67 and run gmtswitch with no argument. Select one of the version
68 from the menu.
69
70 5. If in csh you may have to say rehash afterwards.
71
72 6.
73
74 Type psxy - and the synopsis should tell you that you got the
75 correct version. You can now run gmtswitch from anywhere; try
76 it out and make sure that you can switch between the ver‐
77 sions.
78
80 To switch to GMT version 4.5.7 (assuming it was installed as such and
81 not via a package manager), try
82 gmtswitch GMT4.5.7
83
84 To switch to the default (your top choice), do
85 gmtswitch D
86
87 Finally, to select from the menu, just run
88 gmtswitch
89
90 and pick the one you want.
91
93 GMT remembers where it was installed the first time and uses that dir
94 to find the default GMT share directory. If you move entire GMT instal‐
95 lation after compilation then you may have to set GMT_SHAREDIR to point
96 to the top dir in order for things to work. It is best not to move
97 things after installation.
98
100 Under Windows use gmtswitch.bat which is a batch script that changes
101 the Windows PATH variable so that the BIN directory of the preferred
102 version always comes first. To do that the batch works in two alterna‐
103 tive modes:
104
105 1 - Permanent mode
106
107 2 - Temporary mode
108
109 The permanent mode makes use of the free executable program "EditPath"
110 to change the user path in the registry. It's called permanent because
111 the changes remains until ... next change. See
112
113 http://www.softpedia.com/get/Tweak/Registry-Tweak/EditPath.shtml
114
115 Of course the editpath.exe binary must be in your system's path as
116 well. WARNING: The path change will not be visible on the shell cmd
117 where it was executed. For the change to be active you will need to
118 open a new cmd window.
119
120 The second mode is temporary because the path to the selected GMT
121 binary dir is prepended to the previous path via a shell command line.
122 This modification disappears when the shell cmd window where it was
123 executes is deleted.
124
125 It is the user responsibility to set the contents of the G32_32 to
126 G5_64 below to valid paths where the binaries of the different GMT ver‐
127 sions are installed Note that it is not mandatory to have all four of
128 them in you computer. For the ones you do not have just let them point‐
129 ing to nothing e.g.,
130
131 set G4_64=
132
133 The permanent mode is the default one (but this can be changed. See
134 edit section) To run in the temporary mode just give a second argument
135 (doesn't matter what)
136
137 Example usage to set a GMT5 64 bits permanent
138
139 gmtswitch g5_64
140
141 To temporary set a GMT4 32 bits do
142
143 gmtswitch g4_32 1
144
145 Run without arguments to get a "Usage" (for permanent mode)
146
148 2019, P. Wessel, W. H. F. Smith, R. Scharroo, J. Luis, and F. Wobbe
149
150
151
152
1535.4.5 Feb 24, 2019 GMTSWITCH(1)