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

Last change on this file was 152983, checked in by larryv@…, 3 years ago

guide: Refresh installer list for Sierra release

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