source: trunk/doc-new/guide/xml/installing.xml @ 112489

Last change on this file since 112489 was 112489, checked in by raimue@…, 7 years ago

guide:
Avoid placeholders, use the version number from a entity variable.

File size: 27.4 KB
Line 
1<?xml version="1.0" encoding="UTF-8"?>
2<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
3"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd"[
4<!ENTITY macports-version "2.2.0">
5]>
6<chapter id="installing">
7  <title>Installing MacPorts</title>
8
9  <para>This chapter shows you how to install MacPorts and its prerequisites
10  step-by-step. Note that the sections about <link
11  linkend="installing.x11">installing X11</link> and <link
12  linkend="installing.xcode">installing Xcode</link> are Mac OS X
13  specific. If you wish to install MacPorts on another platform, first make
14  sure you have X11 and gcc installed, and then skip ahead to <link
15  linkend="installing.macports.source">installing MacPorts from source</link>
16  and continue to the end of the chapter.</para>
17
18  <section id="installing.x11">
19    <title>Install X11</title>
20
21    <para>
22      X11.app allows you to run applications using the X Window System, which
23      is the traditional display server on most other UNIX like systems. Additionally, the
24      <ulink url="http://xquartz.macosforge.org/trac/wiki"> Xquartz</ulink>
25      project provides an updated version of the X server.
26    </para>
27
28    <note>
29      <para>
30      As of Mac OS X 10.5 Leopard, X11.app is included in the default
31      installation. You can just <link linkend="installing.xcode">skip this
32      section</link> for any later version of Mac OS X.
33      </para>
34    </note>
35
36    <orderedlist>
37      <listitem>
38        <para>Insert the <quote>Mac OS X Install Disk</quote> and run the
39        package named <quote>Optional Installs</quote>.</para>
40      </listitem>
41
42      <listitem>
43        <para>At the software selection window expand the
44        <guilabel>Applications</guilabel> category and click the check box
45        beside <guilabel>X11</guilabel> (and nothing else).</para>
46      </listitem>
47
48      <listitem>
49        <para>Click <guibutton>Install</guibutton> to install X11.</para>
50      </listitem>
51    </orderedlist>
52
53    <para>Before launching an X11 application on Mac OS X 10.4, you must open X11.app
54    and start an xterm session. Later OS versions should launch X11.app automatically when
55    an X11 application is run from the Terminal.</para>
56
57    <programlisting><prompt>%%</prompt> <userinput>xterm</userinput></programlisting>
58
59    <para>After the X11 session window opens, you may launch X11 apps from
60    another terminal window. See <link
61    linkend="installing.x11.settings">Optional X11 Settings</link> if you wish
62    to launch X11 applications from an X11 session window.</para>
63
64    <note>
65      <para>X11 and the X11SDK (from Xcode Tools) are both required for X11
66      apps. To verify the presence of both, check for files
67      <filename>com.apple.pkg.X11User.bom</filename> &amp;
68      <filename>com.apple.pkg.X11SDKLeo.bom</filename> in
69      <filename>/Library/Receipts/boms/</filename>. On Mac OS X 10.4, look for
70      files <filename>X11User.pkg</filename> &amp;
71      <filename>X11SDK.pkg</filename> in
72      <filename>/Library/Receipts/</filename>.</para>
73    </note>
74
75    <section id="installing.x11.settings">
76      <title>Optional X11 Settings</title>
77
78      <para>To launch X11 applications directly from an X11 window (instead of
79      a regular terminal window), you need to make it so X11 sessions opened
80      using the menu bar respect your <filename>.profile</filename>
81      file.</para>
82
83      <orderedlist>
84        <listitem>
85          <para>Open X11 and select <guimenuitem>Customize Menu
86          ...</guimenuitem> from the <guimenu>Applications</guimenu>
87          menu.</para>
88        </listitem>
89
90        <listitem>
91          <para>Double-click the menu item <guimenuitem>Terminal</guimenuitem>
92          and change: <quote>xterm</quote> to <quote>xterm -ls</quote></para>
93        </listitem>
94
95        <listitem>
96          <para>Click <guibutton>Done</guibutton> to save the change.</para>
97        </listitem>
98      </orderedlist>
99    </section>
100  </section>
101
102  <section id="installing.xcode">
103    <title>Install Xcode</title>
104
105    <para>
106      <ulink url="https://developer.apple.com/xcode/">Xcode</ulink>
107      is a package provided by Apple containing compilers, libraries and
108      additional tools required to develop applications for Mac OS X.
109    </para>
110
111    <note>
112      <para>Always make sure to install the latest available version of Xcode
113      for your Mac OS X release; using outdated versions of Xcode
114      may cause port install failures. Also note that Xcode is not
115      updated via Mac OS X's Software Update utility on OS versions prior
116      to 10.6, and is updated via the Mac App Store on 10.7.</para>
117    </note>
118
119    <para>Follow the instructions for your version of Mac OS X:</para>
120
121    <section id="installing.xcode.mavericks">
122      <title>Install Xcode on OS X 10.9 or later</title>
123
124      <para>
125        Download the latest version of Xcode <ulink
126        url="https://developer.apple.com/downloads/index.action"> from the
127        Apple developer website</ulink> or get it <ulink
128        url="http://itunes.apple.com/us/app/xcode/id497799835">
129        using the Mac App Store</ulink>.
130      </para>
131     
132      <para>
133        Once you have Xcode installed, open a terminal and run
134        <userinput>xcode-select --install</userinput>.
135      </para>
136    </section>
137
138    <section id="installing.xcode.lion">
139      <title>Install Xcode on OS X 10.7 Lion or OS X 10.8 Mountain Lion</title>
140
141      <para>
142        Download the latest version of Xcode <ulink
143          url="https://developer.apple.com/downloads/index.action">from the Apple developer
144          website</ulink> or get it <ulink
145          url="http://itunes.apple.com/us/app/xcode/id497799835">using the Mac
146          App Store</ulink>.
147      </para>
148
149      <section id="installing.xcode.lion.43">
150        <title>Xcode 4.3 and later</title>
151        <para>
152          Xcode 4.3 and later do not automatically install the command line tools, but
153          MacPorts requires them. To install them, open the Xcode application, go to the
154          Preferences window, to the Downloads section, and click the Install button
155          next to Command Line Tools. Be sure to return to this window after every Xcode
156          upgrade to ensure that the command line tools are also upgraded.
157        </para>
158        <para>
159          If you wish to create Installer packages with <userinput>port pkg</userinput>,
160          you will also need to install PackageMaker, which is in the <quote>Auxiliary
161          Tools for Xcode</quote> package as of Xcode 4.3. The download page for this package
162          can be opened via the Xcode -> Open Developer Tool -> More Developer Tools...
163          menu item. After downloading and mounting the disk image, drag the PackageMaker
164          application to your /Applications directory.
165        </para>
166      </section>
167    </section>
168
169    <section id="installing.xcode.snowleopard">
170      <title>Install Xcode on Mac OS X 10.6 Snow Leopard</title>
171
172      <para>If you are using Mac OS X 10.6, there are two branches of Xcode
173        which could be considered to be the latest, 3.2.x and 4.x. Xcode 4
174        costs money, but Xcode 3 is still available free of charge. There are
175        two options for downloading it:
176        <orderedlist>
177          <listitem>
178            <para>
179              <ulink url="https://connect.apple.com/cgi-bin/WebObjects/MemberSite.woa/wa/getSoftware?bundleID=20588">
180                Xcode 3.2.2</ulink> - smaller download, but you will need to run Software Update after installing to
181              get the latest version.
182            </para>
183          </listitem>
184          <listitem>
185            <para>
186              <ulink url="https://connect.apple.com/cgi-bin/WebObjects/MemberSite.woa/wa/getSoftware?bundleID=20792">
187                Xcode 3.2.6 and iOS SDK 4.3</ulink> - includes iOS SDK which is not needed for MacPorts.
188            </para>
189          </listitem>
190        </orderedlist>
191        You may also be able to install Xcode 3.2 from your Mac OS X 10.6 DVD and then run Software Update to get
192        the latest version.
193      </para>
194
195      <para>Ensure that those of the following options that are available in the
196      installer for your version of Xcode are selected:
197      <itemizedlist>
198          <listitem>
199              <guibutton>UNIX Development</guibutton>
200          </listitem>
201          <listitem>
202              <guibutton>System Tools</guibutton>
203          </listitem>
204          <listitem>
205              <guibutton>X11 SDK</guibutton>
206          </listitem>
207          <listitem>
208              <guibutton>Command Line Support</guibutton>
209          </listitem>
210        </itemizedlist>
211      </para>
212    </section>
213
214    <section id="installing.xcode.other">
215      <title>Install Xcode on older releases of Mac OS X</title>
216
217      <para>
218        If you have an earlier release of Mac OS X, you may download
219        the latest version of Xcode
220        <ulink
221          url="http://connect.apple.com/cgi-bin/WebObjects/MemberSite.woa/wa/getSoftware?bundleID=20491">for OS X 10.5 (v3.1.4)</ulink>
222        or
223        <ulink
224          url="http://connect.apple.com/cgi-bin/WebObjects/MemberSite.woa/wa/getSoftware?bundleID=19907">for 10.4 (v2.5)</ulink>.
225      </para>
226
227      <para>Ensure that those of the following options that are available in the
228      installer for your version of Xcode are selected:
229      <itemizedlist>
230          <listitem>
231              <guibutton>UNIX Development</guibutton>
232          </listitem>
233          <listitem>
234              <guibutton>System Tools</guibutton>
235          </listitem>
236          <listitem>
237              <guibutton>X11 SDK</guibutton>
238          </listitem>
239          <listitem>
240              <guibutton>Command Line Support</guibutton>
241          </listitem>
242        </itemizedlist>
243      </para>
244    </section>
245  </section>
246
247  <section id="installing.macports">
248    <title>Install MacPorts</title>
249
250    <para>If you are using Mac OS X, you should install MacPorts using the Mac
251    OS X package installer unless you do not wish to install it to
252    <filename>/opt/local/</filename>, the default MacPorts location, or if you
253    wish to install a pre-release version of MacPorts base. However, if you
254    wish to <link linkend="installing.macports.source.multiple">install
255    multiple copies of MacPorts</link> or install MacPorts on another OS
256    platform, you must <link linkend="installing.macports.source">install
257    MacPorts from the source code</link>.</para>
258
259    <note>
260      <para>Though a distinction is made between pre-release and release
261      versions of MacPorts base, the ports collection supports no such
262      distinction or versioning. The <link
263      linkend="using.port.selfupdate">selfupdate</link> command installs the
264      latest port revisions from Subversion (at a slight delay), and updates
265      MacPorts base to the latest released version.</para>
266    </note>
267
268    <section id="installing.macports.binary">
269      <title>Mac OS X Package Install</title>
270
271      <para>The Mac OS X package installer automatically installs MacPorts,
272      <link linkend="installing.shell">sets the shell environment</link>, and
273      runs a <link linkend="using.port.selfupdate">selfupdate</link> operation
274      to update the ports tree and MacPorts base with the latest
275      release.</para>
276
277      <orderedlist>
278        <listitem>
279          <para>Download the latest <filename>MacPorts-&macports-version;.dmg</filename>
280          disk image (whose name does not contain -beta or -rc) from the <ulink
281          url="https://distfiles.macports.org/MacPorts/">MacPorts
282          download directory</ulink>.</para>
283        </listitem>
284
285        <listitem>
286          <para>Double-click the <filename>MacPorts-&macports-version;.pkg</filename>
287          package installer on the disk image.</para>
288        </listitem>
289
290        <listitem>
291          <para>Perform the default <quote>easy</quote> install.</para>
292        </listitem>
293      </orderedlist>
294    </section>
295
296    <section id="installing.macports.source">
297      <title>Source Install</title>
298
299      <para>If you installed MacPorts using the package installer, skip this
300      section. To install MacPorts from the source code, follow the steps
301      below.</para>
302
303      <orderedlist>
304        <listitem>
305          <para>Download and extract the <ulink url="https://distfiles.macports.org/MacPorts/MacPorts-&macports-version;.tar.bz2">
306          MacPorts &macports-version; tarball</ulink>. Either do so using your browser and the Finder, or use the given commands
307          in a terminal window.</para>
308
309          <programlisting><prompt>%%</prompt> <userinput>curl -O https://distfiles.macports.org/MacPorts/MacPorts-&macports-version;.tar.bz2</userinput>
310<prompt>%%</prompt> <userinput>tar xf MacPorts-&macports-version;.tar.bz2</userinput></programlisting>
311        </listitem>
312
313        <listitem>
314          <para>Afterwards, perform the commands shown in the terminal window. If you wish
315          to use a path other than <filename>/opt/local</filename>, follow
316          the instructions for <link linkend="installing.macports.source.multiple">installing
317          multiple copies of MacPorts</link> instead.</para>
318
319          <programlisting><prompt>%%</prompt> <userinput>cd MacPorts-&macports-version;/</userinput>
320<prompt>%%</prompt> <userinput>./configure</userinput>
321<prompt>%%</prompt> <userinput>make</userinput>
322<prompt>%%</prompt> <userinput>sudo make install</userinput></programlisting>
323        </listitem>
324      </orderedlist>
325    </section>
326
327    <section id="installing.macports.subversion">
328      <title>Subversion Install</title>
329
330      <para>If you installed MacPorts using the package installer, skip this
331      section.</para>
332
333      <para>There are times when some may want to run MacPorts from a version
334      newer than the current stable release. Maybe there's a new feature that
335      you'd like to use, or it fixes an issue you've encountered, or you just
336      like to be on the cutting edge. These steps explain how to run
337      completely from trunk, using only Subversion to keep MacPorts up to
338      date.</para>
339
340      <orderedlist>
341        <listitem>
342          <para>Check out MacPorts source</para>
343
344          <para>Pick a location to store a working copy of the MacPorts code.
345          For this example, <filename>/opt/mports</filename> will be used, but
346          you can put the source anywhere. This example will create
347          <filename>/opt/mports/trunk</filename> containing everything needed
348          for MacPorts.</para>
349
350          <programlisting><prompt>%%</prompt> <userinput>mkdir -p /opt/mports</userinput>
351<prompt>%%</prompt> <userinput>cd /opt/mports</userinput>
352<prompt>%%</prompt> <userinput>svn checkout https://svn.macports.org/repository/macports/trunk</userinput></programlisting>
353
354          <note>
355              <para>
356             You only really need the base subdirectory to run MacPorts, so you can avoid checking out the rest if you don't want to use a Subversion-based ports tree (see Step 3 below). To just get the base directory, append
357
358            <filename>/base</filename>
359
360             to the end of the svn checkout command above. The resulting directory will then be
361
362            <filename>/opt/mports/base</filename>
363
364            </para>
365          </note>
366        </listitem>
367
368        <listitem>
369          <para>Build and Install MacPorts</para>
370
371          <para>MacPorts uses autoconf and makefiles for installation. These
372          commands will build and install MacPorts to
373          <filename>/opt/local</filename>. You can add the
374          <option>--prefix</option> option to <filename>./configure</filename>
375          to relocate MacPorts to another directory if needed.</para>
376
377          <programlisting><prompt>%%</prompt> <userinput>cd /opt/mports/trunk/base</userinput>
378<prompt>%%</prompt> <userinput>./configure --enable-readline</userinput>
379<prompt>%%</prompt> <userinput>make</userinput>
380<prompt>%%</prompt> <userinput>sudo make install</userinput>
381<prompt>%%</prompt> <userinput>make distclean</userinput></programlisting>
382        </listitem>
383
384        <listitem>
385          <para>(Optional) Configure MacPorts to use port information from
386          Subversion</para>
387
388          <para>This step is useful if you want to do port development. Open
389          <filename>/opt/local/etc/macports/sources.conf</filename> in a text
390          editor. The last line which should look like this:</para>
391
392          <programlisting>rsync://rsync.macports.org/release/tarballs/ports.tar [default]</programlisting>
393
394          <para>Change it to point to the working copy you checked out:</para>
395
396          <programlisting>file:///opt/mports/trunk/dports [default]</programlisting>
397
398          <para>Now MacPorts will look for portfiles in the working
399          copy.</para>
400        </listitem>
401
402        <listitem>
403          <para>Environment</para>
404
405          <para>You should setup your PATH and other environment options
406          according to the <link linkend="installing.shell">following
407          section</link>.</para>
408        </listitem>
409      </orderedlist>
410    </section>
411
412    <section id="installing.macports.source.multiple">
413      <title>Install Multiple MacPorts Copies</title>
414
415      <para>Occasionally a MacPorts developer may wish to install more than
416      one MacPorts instance on the same host. Only one copy of MacPorts may
417      use the default prefix <filename>/opt/local</filename>, so
418      for additional installations use the option
419      <option>--prefix</option> as shown below. It's also recommended
420      to change the applications dir using
421      <option>--with-applications-dir</option> to avoid conflicts in
422      <filename>/Applications/MacPorts</filename>.</para>
423
424      <note>
425        <para>The first command temporarily removes the standard MacPorts
426        binary paths because they must not be present while installing a
427        second instance.</para>
428      </note>
429
430      <programlisting><prompt>%%</prompt> <userinput>export PATH=/bin:/sbin:/usr/bin:/usr/sbin</userinput>
431<prompt>%%</prompt> <userinput>MP_PREFIX=/opt/macports-test</userinput>
432<prompt>%%</prompt> <userinput>./configure --prefix=$MP_PREFIX --with-applications-dir=$MP_PREFIX/Applications</userinput>
433<prompt>%%</prompt> <userinput>make</userinput>
434<prompt>%%</prompt> <userinput>sudo make install</userinput>
435</programlisting>
436    </section>
437  </section>
438
439  <section id="installing.macports.upgrade">
440    <title>MacPorts Upgrade</title>
441
442    <para>MacPorts base upgrades are performed automatically (when a newer
443    release is available) during a <link
444    linkend="using.port.selfupdate">selfupdate</link> operation. To upgrade a
445    copy of MacPorts that was installed from source to the newer release of
446    the source code, simply repeat the <link
447    linkend="installing.macports.source">source install</link> with the newer
448    version of the MacPorts source code.</para>
449  </section>
450
451  <section id="installing.macports.uninstalling">
452    <title>Uninstall</title>
453
454    <para>Uninstalling MacPorts can be a drastic step, and depending on the
455    issue you are experiencing, you may not need to do so. If you are unsure,
456    ask on the
457    <ulink url="http://lists.macosforge.org/mailman/listinfo/macports-users">macports-users</ulink>
458    mailing list first.</para>
459   
460    <para>If you need to uninstall MacPorts, and your <command>port</command> command is
461    functioning, first uninstall all the installed ports by running this
462    command in the Terminal:</para>
463    <programlisting><prompt>%%</prompt> <userinput>sudo port -fp uninstall installed</userinput></programlisting>
464
465    <para>All that will be left in your installation prefix now will be files
466    that were not registered to any port. This includes configuration
467    files, databases, any files which MacPorts
468    renamed in order to allow a forced installation or upgrade, and the base
469    MacPorts software itself. You may wish to save your configuration files
470    (most are in <filename>${prefix}/etc</filename>), databases, or any other
471    unique data by moving it aside.</para>
472
473    <para>To remove all remaining traces of MacPorts, run the following
474    command in the Terminal. If you have changed <varname>prefix</varname>,
475    <varname>applications_dir</varname> or <varname>frameworks_dir</varname>
476    from their default values, then replace <filename>/opt/local</filename>
477    with your <varname>prefix</varname>, replace <filename>/Applications/MacPorts</filename>
478    with your <varname>applications_dir</varname>, and/or add your
479    <varname>frameworks_dir</varname> to the list, respectively.</para>
480    <programlisting><prompt>%%</prompt> <userinput>sudo rm -rf \
481    /opt/local \
482    /Applications/DarwinPorts \
483    /Applications/MacPorts \
484    /Library/LaunchDaemons/org.macports.* \
485    /Library/Receipts/DarwinPorts*.pkg \
486    /Library/Receipts/MacPorts*.pkg \
487    /Library/StartupItems/DarwinPortsStartup \
488    /Library/Tcl/darwinports1.0 \
489    /Library/Tcl/macports1.0 \
490    ~/.macports</userinput></programlisting>
491 
492  <para>If you use a shell other than bash (perhaps tcsh), you may need to
493  adjust the above to fit your shell's syntax. Also note that depending on which
494  version of MacPorts you have and which ports you have installed, not all of
495  the above paths will exist on your system. This is OK.</para>
496  </section>
497
498  <section id="installing.shell">
499    <title>MacPorts and the Shell</title>
500
501    <para>MacPorts requires that some environment variables be set in the
502    shell. When MacPorts is installed using the Mac OS X package installer, a
503    <quote>postflight</quote> script is run after installation that
504    automatically adds or modifies a shell configuration file in your home directory,
505    ensuring that it defines variables
506    according to the rules described in the following section. Those <link
507    linkend="installing.macports.source">installing MacPorts from source
508    code</link> must modify their environment manually using the rules as a
509    guide.</para>
510
511    <para>Depending on your shell and which configuration files already exist, the
512    installer may use <filename>.profile</filename>, <filename>.bash_login</filename>,
513    <filename>.bash_profile</filename>, <filename>.tcshrc</filename>, or
514    <filename>.cshrc</filename>.</para>
515
516    <section id="installing.shell.postflight">
517      <title>The Postflight Script</title>
518
519      <para>The postflight script automatically sets
520      the <varname>PATH</varname>
521      variable, and optionally the <varname>MANPATH</varname> and
522      <varname>DISPLAY</varname> variables according to the rules described
523      below. If a current shell configuration file exists at
524      installation time it is renamed to <quote>mpsaved_$timestamp</quote>.
525      Those <link linkend="installing.macports.source">installing MacPorts
526      from source code</link> must modify their environment manually using the
527      rules as a guide.</para>
528
529      <itemizedlist>
530        <listitem>
531          <para>Required: <varname>PATH</varname> variable</para>
532
533          <para>This variable is set by the postflight script to append the
534          MacPorts executable paths to the default path as shown. The MacPorts
535          paths are appended at the front of <varname>PATH</varname> so the
536          MacPorts libraries will take precedence over vendor-supplied
537          libraries for ported software at runtime.</para>
538
539          <programlisting>export PATH=/opt/local/bin:/opt/local/sbin:$PATH</programlisting>
540
541          <note>
542            <para>The user environment's $PATH is not in effect while ports
543            are being installed, because the $PATH is scrubbed before ports
544            are installed, and restored afterwards. To change the search path
545            for locating system executables (rsync, tar, etc.) during port
546            installation, see the <link
547            linkend="internals.configuration-files.macports-conf">macports.conf</link>
548            file variable <varname>binpath</varname>. But changing this
549            variable is for advanced users only, and is not generally needed
550            or recomended.</para>
551          </note>
552        </listitem>
553
554        <listitem>
555          <para>Optional: <varname>MANPATH</varname> variable</para>
556
557          <para>Condition: If prior to MacPorts installation a
558          <varname>MANPATH</varname> variable exists in a current
559          <filename>.profile</filename> that contains neither the value
560          <filename>${prefix}/share/man,</filename> nor any empty values, the
561          postflight script sets the <varname>MANPATH</varname> variable as
562          shown below. Otherwise, the <varname>MANPATH</varname> variable is
563          omitted.</para>
564
565          <programlisting>export MANPATH=/opt/local/share/man:$MANPATH</programlisting>
566
567          <para>Here are some examples of paths that contain empty
568          values:</para>
569
570          <simplelist>
571            <member>/usr/share/man:</member>
572
573            <member>:/usr/share/man</member>
574
575            <member>/usr/share/man::/usr/X11R6/man</member>
576          </simplelist>
577        </listitem>
578
579        <listitem>
580          <para>Optional: <varname>DISPLAY</varname> variable</para>
581
582          <para>Condition: If installing on a Mac OS X version earlier than
583          10.5 (Leopard), and if a shell configuration file exists
584          at time of MacPorts installation without a
585          <varname>DISPLAY</varname> variable, the postflight script sets a
586          <varname>DISPLAY</varname> variable as shown below. The
587          <varname>DISPLAY</varname> variable is always omitted on Mac OS X
588          10.5 or higher.</para>
589
590          <programlisting>export DISPLAY=:0.0</programlisting>
591        </listitem>
592      </itemizedlist>
593    </section>
594
595    <section id="installing.shell.verifyprofile">
596      <title>Verify the configuration file</title>
597
598      <para>To verify that the file containing the
599      MacPorts variables is in effect, type <command>env</command> in the
600      terminal to verify the current environment settings after the
601      file has been created. Example output for the
602      <command>env</command> command is shown below.</para>
603
604      <note>
605        <para>Changes to shell configuration files do not take effect
606        until a new terminal session is opened.</para>
607      </note>
608
609      <screen>MANPATH=
610TERM_PROGRAM=Apple_Terminal
611TERM=xterm-color
612SHELL=/bin/bash
613TERM_PROGRAM_VERSION=237
614USER=joebob
615__CF_USER_TEXT_ENCODING=0x1FC:0:0
616PATH=/opt/local/bin:/opt/local/sbin:/bin:/sbin:/usr/bin:/usr/sbin
617PWD=/Users/joebob
618EDITOR=/usr/bin/pico
619SHLVL=1
620HOME=/Users/joebob
621LOGNAME=joebob
622DISPLAY=:0.0
623SECURITYSESSIONID=b0cea0
624_=/usr/bin/env</screen>
625    </section>
626
627    <section id="installing.shell.editorvar">
628      <title>Optional Editor Variables</title>
629
630      <para>You can set an environment variable in order to use your favorite
631      text editor with edit option of port command.</para>
632      <para>MacPorts will check <varname>MP_EDITOR</varname>,
633      <varname>VISUAL</varname> and <varname>EDITOR</varname> in this order,
634      allowing you to either use a default editor shared with other programs
635      (<varname>VISUAL</varname> and <varname>EDITOR</varname>) or a Macports'
636      specific one (<varname>MP_EDITOR</varname>).</para>
637
638      <para>For example, to use the nano editor, add this line to your
639      bash config:</para>
640
641      <programlisting>export EDITOR=/usr/bin/nano</programlisting>
642
643      <para>To use the user-friendly GUI editor <ulink
644      url="http://www.barebones.com/products/textwrangler/">TextWrangler</ulink>
645      (installation required), add this line:</para>
646
647      <programlisting>export EDITOR=/usr/bin/edit</programlisting>
648     
649      <para>To keep a command-line text editor as default while using a graphic editor with
650      portfiles, add this: </para>
651
652      <programlisting>
653      export EDITOR=/usr/bin/vi
654      export MP_EDITOR=/usr/bin/edit</programlisting>
655    </section>
656  </section>
657</chapter>
Note: See TracBrowser for help on using the repository browser.