Files
macports-guide/guide/xml/installing.xml
2026-03-18 10:44:28 +11:00

619 lines
36 KiB
XML
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?xml version="1.0" encoding="UTF-8"?>
<!-- -*- 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
-->
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V5.0//EN"
"http://docbook.org/xml/5.0/dtd/docbook.dtd"[
<!ENTITY macports-version "2.12.4">
]>
<chapter xml:id="installing" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>Installing MacPorts</title>
<para>This chapter shows you how to install MacPorts and its prerequisites step-by-step. Note that the section about
<link linkend="installing.xcode">installing Xcode</link> is macOS-specific. If you wish to install MacPorts on
another platform, first make sure you have a working C compiler installed, skip ahead to <link
linkend="installing.macports.source">installing MacPorts from source</link>, and continue to the end of the
chapter.</para>
<section xml:id="installing.xcode">
<title>Install Xcode</title>
<para><link xlink:href="https://developer.apple.com/xcode/">Xcode</link> is a package provided by Apple containing
compilers, libraries and additional tools required to develop applications for macOS.</para>
<note>
<para>Always make sure to install the latest available version of Xcode for your macOS release; using
outdated versions of Xcode may cause port install failures. Also note that Xcode is not updated via OS
X's Software Update utility on OS versions prior to 10.6, and is updated via the Mac App Store starting
with 10.7.</para>
</note>
<para>Follow the instructions for your version of macOS:</para>
<section xml:id="installing.xcode.mavericks">
<title>Install Xcode on OS X 10.9 or Later</title>
<para>(Optional) Download the latest version of Xcode <link
xlink:href="https://developer.apple.com/downloads/index.action">from the Apple developer website</link> or
get it <link xlink:href="https://itunes.apple.com/us/app/xcode/id497799835">using the Mac App
Store</link>.</para>
<para>A few ports require a full Xcode installation to use, but most dont
(read the description of the <link linkend="reference.keywords.use_xcode">use_xcode keyword</link> for specifics).
If you are OK with being unable to use these ports, you do not need to install Xcode.</para>
<para>Next, open a terminal, run <userinput>xcode-select --install</userinput>, and
click the Install button to install the required command line developer tools. Don't worry if you see
a message telling you the software cannot be installed because it is not currently available from the
Software Update Server. This usually means you already have the latest version installed. You can also
get the command line tools from <link xlink:href="https://developer.apple.com/downloads/index.action">the
Apple developer website</link>.</para>
</section>
<section xml:id="installing.xcode.lion">
<title>Install Xcode on OS X 10.7 Lion or OS X 10.8 Mountain Lion</title>
<para>Download the latest version of Xcode <link
xlink:href="https://developer.apple.com/downloads/index.action">from the Apple developer website</link> or
get it <link xlink:href="https://itunes.apple.com/us/app/xcode/id497799835">using the Mac App
Store</link>.</para>
<section xml:id="installing.xcode.lion.43">
<title>Xcode 4.3 and Later</title>
<para>Xcode 4.3 and later do not automatically install the command line tools, but MacPorts requires
them. To install them, open the Xcode application, go to the Preferences window, to the Downloads
section, and click the Install button next to Command Line Tools. Be sure to return to this window
after every Xcode upgrade to ensure that the command line tools are also upgraded.</para>
<para>If you wish to create Installer packages with <userinput>port pkg</userinput>, you will also need
to install PackageMaker, which is in the <quote>Auxiliary Tools for Xcode</quote> package as of
Xcode 4.3. The download page for this package can be opened via the Xcode -> Open Developer Tool ->
More Developer Tools... menu item. After downloading and mounting the disk image, drag the
PackageMaker application to your /Applications directory.</para>
</section>
</section>
<section xml:id="installing.xcode.snowleopard">
<title>Install Xcode on Mac OS X 10.6 Snow Leopard</title>
<para>If you are using Mac OS X 10.6, there are two branches of Xcode which could be considered to be the
latest, 3.2.x and 4.x. Xcode 4 costs money, but Xcode 3 is still available free of charge. There are two
options for downloading it:</para>
<orderedlist>
<listitem>
<para>Xcode 3.2 - smaller download, but you will need to run Software Update after installing to
get the latest version. Note that Apple might at some point discontinue providing these
updates via their update servers.</para>
</listitem>
<listitem>
<para>Xcode 3.2.6 and iOS SDK 4.3 - includes the iOS SDK which is not needed for
MacPorts.</para>
</listitem>
</orderedlist>
<para>Both are available from the <link xlink:href="https://developer.apple.com/downloads/index.action">Apple
developer website</link>. 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 the latest version.</para>
<para>Ensure that those of the following options that are available in the installer for your version of
Xcode are selected:</para>
<itemizedlist>
<listitem>
<para><guibutton>UNIX Development</guibutton></para>
</listitem>
<listitem>
<para><guibutton>System Tools</guibutton></para>
</listitem>
<listitem>
<para><guibutton>X11 SDK</guibutton></para>
</listitem>
<listitem>
<para><guibutton>Command Line Support</guibutton></para>
</listitem>
</itemizedlist>
</section>
<section xml:id="installing.xcode.other">
<title>Install Xcode on Older Releases of Mac OS X</title>
<para>If you have an earlier release of Mac OS X, you may download the latest version of Xcode for Mac OS X 10.5
(Xcode 3.0 and Xcode 3.1 Developer Tools) or 10.4 (Xcode 2.4.1 and Xcode 2.5 Developer Tools) from the
<link xlink:href="https://developer.apple.com/downloads/index.action">Apple developer website</link>.</para>
<para>Ensure that those of the following options that are available in the installer for your version of
Xcode are selected:</para>
<itemizedlist>
<listitem>
<para><guibutton>UNIX Development</guibutton></para>
</listitem>
<listitem>
<para><guibutton>System Tools</guibutton></para>
</listitem>
<listitem>
<para><guibutton>X11 SDK</guibutton></para>
</listitem>
<listitem>
<para><guibutton>Command Line Support</guibutton></para>
</listitem>
</itemizedlist>
</section>
</section>
<section xml:id="installing.macports">
<title>Install MacPorts</title>
<para>If you are using macOS, you should install MacPorts using the macOS package installer unless you do not wish
to install it to <filename>/opt/local/</filename>, the default MacPorts location, or if you wish to install
a pre-release version of MacPorts base. However, if you wish to <link
linkend="installing.macports.source.multiple">install multiple copies of MacPorts</link> or install
MacPorts on another OS platform, you must <link linkend="installing.macports.source">install MacPorts from
the source code</link>.</para>
<section xml:id="installing.macports.binary">
<title>macOS Package Install</title>
<para>The macOS package installer automatically installs MacPorts, <link linkend="installing.shell">sets the
shell environment</link>, and runs a <link linkend="using.port.selfupdate">selfupdate</link>
operation to update the ports tree and MacPorts base with the latest release.</para>
<orderedlist>
<listitem>
<para>Download the latest
<filename>MacPorts-&macports-version;-<replaceable>....</replaceable>pkg</filename> installer from the releases
<link xlink:href="https://github.com/macports/macports-base/releases/">on GitHub</link>. Here
are direct links for the latest versions of macOS:</para>
<variablelist>
<varlistentry>
<term>
macOS 15 Sequoia:
</term>
<listitem>
<para><link xlink:href="https://github.com/macports/macports-base/releases/download/v&macports-version;/MacPorts-&macports-version;-15-Sequoia.pkg">MacPorts-&macports-version;-15-Sequoia.pkg</link></para>
</listitem>
</varlistentry>
<varlistentry>
<term>
macOS 14 Sonoma:
</term>
<listitem>
<para><link xlink:href="https://github.com/macports/macports-base/releases/download/v&macports-version;/MacPorts-&macports-version;-14-Sonoma.pkg">MacPorts-&macports-version;-14-Sonoma.pkg</link></para>
</listitem>
</varlistentry>
<varlistentry>
<term>
macOS 13 Ventura:
</term>
<listitem>
<para><link xlink:href="https://github.com/macports/macports-base/releases/download/v&macports-version;/MacPorts-&macports-version;-13-Ventura.pkg">MacPorts-&macports-version;-13-Ventura.pkg</link></para>
</listitem>
</varlistentry>
<varlistentry>
<term>
macOS 12 Monterey:
</term>
<listitem>
<para><link xlink:href="https://github.com/macports/macports-base/releases/download/v&macports-version;/MacPorts-&macports-version;-12-Monterey.pkg">MacPorts-&macports-version;-12-Monterey.pkg</link></para>
</listitem>
</varlistentry>
<varlistentry>
<term>
macOS 11 Big Sur:
</term>
<listitem>
<para><link xlink:href="https://github.com/macports/macports-base/releases/download/v&macports-version;/MacPorts-&macports-version;-11-BigSur.pkg">MacPorts-&macports-version;-11-BigSur.pkg</link></para>
</listitem>
</varlistentry>
<varlistentry>
<term>
macOS 10.15 Catalina:
</term>
<listitem>
<para><link xlink:href="https://github.com/macports/macports-base/releases/download/v&macports-version;/MacPorts-&macports-version;-10.15-Catalina.pkg">MacPorts-&macports-version;-10.15-Catalina.pkg</link></para>
</listitem>
</varlistentry>
<varlistentry>
<term>
macOS 10.14 Mojave:
</term>
<listitem>
<para><link xlink:href="https://github.com/macports/macports-base/releases/download/v&macports-version;/MacPorts-&macports-version;-10.14-Mojave.pkg">MacPorts-&macports-version;-10.14-Mojave.pkg</link></para>
</listitem>
</varlistentry>
<varlistentry>
<term>
macOS 10.13 High Sierra:
</term>
<listitem>
<para><link xlink:href="https://github.com/macports/macports-base/releases/download/v&macports-version;/MacPorts-&macports-version;-10.13-HighSierra.pkg">MacPorts-&macports-version;-10.13-HighSierra.pkg</link></para>
</listitem>
</varlistentry>
<varlistentry>
<term>
macOS 10.12 Sierra:
</term>
<listitem>
<para><link xlink:href="https://github.com/macports/macports-base/releases/download/v&macports-version;/MacPorts-&macports-version;-10.12-Sierra.pkg">MacPorts-&macports-version;-10.12-Sierra.pkg</link></para>
</listitem>
</varlistentry>
</variablelist>
</listitem>
<listitem>
<para>Double-click the downloaded package installer to perform the default <quote>easy</quote>
install.</para>
</listitem>
<listitem>
<para>After this step you are done already, MacPorts is now installed and your shell environment was
set up automatically by the installer. To confirm the installation is working as expected, now
try using <command>port</command> in a <emphasis>new</emphasis> terminal
window.</para>
<programlisting><prompt>$</prompt> <userinput>port version</userinput></programlisting>
<screen>Version: &macports-version;</screen>
<para>In case of problems such as <quote>command not found</quote>, make sure that you opened a new
terminal window or consult <xref linkend="installing.shell"/>. Otherwise, please skip the
remainder of this chapter and continue with <xref linkend="using"/> in this guide.</para>
</listitem>
</orderedlist>
</section>
<section xml:id="installing.macports.source">
<title>Source Install</title>
<para>If you installed MacPorts using the package installer, skip this section. To install MacPorts from the
source code, follow the steps below.</para>
<orderedlist>
<listitem>
<para>Download and extract the <link
xlink:href="https://distfiles.macports.org/MacPorts/MacPorts-&macports-version;.tar.bz2"> MacPorts
&macports-version; tarball</link>. Either do so using your browser and the Finder, or use
the given commands in a terminal window.</para>
<programlisting><prompt>$</prompt> <userinput>curl -O https://distfiles.macports.org/MacPorts/MacPorts-&macports-version;.tar.bz2</userinput>
<!-- --><prompt>$</prompt> <userinput>tar xf MacPorts-&macports-version;.tar.bz2</userinput></programlisting>
</listitem>
<listitem>
<para>Afterwards, perform the commands shown in the terminal window. If you wish to use a path other
than <filename>/opt/local</filename>, follow the instructions for <link
linkend="installing.macports.source.multiple">installing multiple copies of MacPorts</link>
instead.</para>
<programlisting><prompt>$</prompt> <userinput>cd MacPorts-&macports-version;/</userinput>
<!-- --><prompt>$</prompt> <userinput>./configure</userinput>
<!-- --><prompt>$</prompt> <userinput>make</userinput>
<!-- --><prompt>$</prompt> <userinput>sudo make install</userinput></programlisting>
</listitem>
<listitem>
<para>Please continue with <xref linkend="installing.shell" /> to set up your shell
environment.</para>
</listitem>
</orderedlist>
</section>
<section xml:id="installing.macports.git">
<title>Git Install</title>
<para>If you installed MacPorts using the package installer, skip this section.</para>
<para>There are times when some may want to run MacPorts from a version newer than the current stable
release. Maybe there's a new feature that you'd like to use, or it fixes an issue you've encountered, or
you just like to be on the cutting edge. These steps explain how to setup MacPorts for developers,
using only Git to keep MacPorts up to date.</para>
<para>Though a distinction is made between pre-release and release versions of MacPorts base, the ports
collection supports no such distinction or versioning. The <link linkend="using.port.selfupdate">selfupdate</link>
command installs the latest ports tree, and updates MacPorts base to the latest released version.</para>
<orderedlist>
<listitem>
<para>Check out MacPorts source</para>
<para>Pick a location to store a working copy of the MacPorts code. For this example,
<filename>/opt/mports</filename> will be used, but you can put the source anywhere. This example
will create <filename>/opt/mports/macports-base</filename> containing everything needed for
MacPorts.</para>
<programlisting><prompt>$</prompt> <userinput>mkdir -p /opt/mports</userinput>
<!-- --><prompt>$</prompt> <userinput>cd /opt/mports</userinput>
<!-- --><prompt>$</prompt> <userinput>git clone https://github.com/macports/macports-base.git</userinput>
<!-- --><prompt>$</prompt> <userinput>cd macports-base</userinput>
<!-- --><prompt>$</prompt> <userinput>git checkout v&macports-version; # skip this if you want to use the development version</userinput></programlisting>
</listitem>
<listitem>
<para>Build and Install MacPorts</para>
<para>MacPorts uses autoconf and makefiles for installation. These commands will build and install
MacPorts to <filename>/opt/local</filename>. You can add <option>--prefix</option> to
<filename>./configure</filename> to relocate MacPorts to another directory if needed.</para>
<programlisting><prompt>$</prompt> <userinput>cd /opt/mports/macports-base</userinput>
<!-- --><prompt>$</prompt> <userinput>./configure --enable-readline</userinput>
<!-- --><prompt>$</prompt> <userinput>make</userinput>
<!-- --><prompt>$</prompt> <userinput>sudo make install</userinput>
<!-- --><prompt>$</prompt> <userinput>make distclean</userinput></programlisting>
</listitem>
<listitem>
<para>(Optional) Configure MacPorts to use port information from Git</para>
<para>This step is useful if you want to do port development. Check out the ports tree from git:</para>
<programlisting><prompt>$</prompt> <userinput>cd /opt/mports</userinput>
<!-- --><prompt>$</prompt> <userinput>git clone https://github.com/macports/macports-ports.git</userinput></programlisting>
<para>Then open
<filename>/opt/local/etc/macports/sources.conf</filename> in a text editor. The last line
should look like this:</para>
<programlisting>rsync://rsync.macports.org/macports/release/tarballs/ports.tar [default]</programlisting>
<para>Change it to point to the working copy you checked out:</para>
<programlisting>file:///opt/mports/macports-ports [default]</programlisting>
<para>Now MacPorts will look for portfiles in the working copy and use Git instead of rsync
to update your ports tree.</para>
</listitem>
<listitem>
<para>Environment</para>
<para>You should setup your PATH and other environment options according to <xref
linkend="installing.shell" />.</para>
</listitem>
</orderedlist>
</section>
<section xml:id="installing.macports.source.multiple">
<title>Install Multiple MacPorts Copies</title>
<para>Occasionally a MacPorts developer may wish to install more than one MacPorts instance on the same
host. Only one copy of MacPorts may use the default prefix <filename>/opt/local</filename>, so for
additional installations use the option <option>--prefix</option> as shown below. It's also recommended
to change the applications dir using <option>--with-applications-dir</option> to avoid conflicts in
<filename>/Applications/MacPorts</filename>.
Use <option>--without-startupitems</option> to automatically set <option>startupitem_install no</option>
in the new <filename>macports.conf</filename>, which is required to avoid conflicts in
<filename>/Library/LaunchAgents</filename> or <filename>/Library/LaunchDaemons</filename>.
</para>
<note>
<para>The first command temporarily removes the standard MacPorts binary paths because they must not be
present while installing a second instance.</para>
</note>
<programlisting><prompt>$</prompt> <userinput>export PATH=/bin:/sbin:/usr/bin:/usr/sbin</userinput>
<!-- --><prompt>$</prompt> <userinput>MP_PREFIX=/opt/macports-test</userinput>
<!-- --><prompt>$</prompt> <userinput>./configure --prefix=$MP_PREFIX --with-applications-dir=$MP_PREFIX/Applications --without-startupitems</userinput>
<!-- --><prompt>$</prompt> <userinput>make</userinput>
<!-- --><prompt>$</prompt> <userinput>sudo make install</userinput></programlisting>
</section>
</section>
<section xml:id="installing.macports.upgrade">
<title>Upgrade MacPorts</title>
<para>MacPorts base upgrades are performed automatically (when a newer release is available) during a <link
linkend="using.port.selfupdate">selfupdate</link> operation. To upgrade a copy of MacPorts that was
installed from source to the newer release of the source code, simply repeat the <link
linkend="installing.macports.source">source install</link> with the newer version of the MacPorts source
code.</para>
</section>
<section xml:id="installing.macports.uninstalling">
<title>Uninstall MacPorts</title>
<para>Uninstalling MacPorts is a drastic step and, depending on the issue you are experiencing, you may not need
to do so. If you are unsure, ask on the <link
xlink:href="https://lists.macports.org/mailman/listinfo/macports-users">macports-users</link> mailing
list first. If you are sure you want to uninstall, read on.</para>
<section xml:id="installing.macports.uninstalling.ports">
<title>Uninstall All Ports</title>
<para>If you want to uninstall MacPorts and the <command>port</command> command is functioning, first
uninstall all the installed ports by running this command in the Terminal:</para>
<programlisting><prompt>$</prompt> <userinput>sudo port -fp uninstall installed</userinput></programlisting>
<para>All that will be left in your installation prefix now will be files that were not registered to any
port. This includes configuration files, databases, any files which MacPorts renamed in order to allow a
forced installation or upgrade, and the base MacPorts software itself. You may wish to save your
configuration files (most are in <filename>$prefix/etc</filename>), databases, or any other unique data
by moving it aside.</para>
<para>If the <command>port</command> command is not functioning, you can proceed on to the next steps, but
if you had installed any ports that install files to nonstandard locations, those files might not be
removed.</para>
</section>
<section xml:id="installing.macports.uninstalling.users">
<title>Remove Users and Groups</title>
<para>When MacPorts is installed, a <filename>macports</filename> macOS user and group are created for
privilege separation. If you want to remove them, you can use these commands from an account that has
admin privileges:</para>
<programlisting><prompt>$</prompt> <userinput>sudo dscl . -delete /Users/macports</userinput>
<!-- --><prompt>$</prompt> <userinput>sudo dscl . -delete /Groups/macports</userinput></programlisting>
<para>If you configured MacPorts to use a different user or group name, then specify that instead of
<filename>macports</filename>.</para>
<para>Individual ports may create users and groups as well; you can remove them with the same commands, but
replacing <filename>macports</filename> with the user or group name you wish to delete.</para>
</section>
<section xml:id="installing.macports.uninstalling.everything">
<title>Remove the Rest of MacPorts</title>
<para>If you want to remove all remaining traces of MacPorts, run the following command in the Terminal. If
you have changed <varname>prefix</varname>, <varname>applications_dir</varname> or
<varname>frameworks_dir</varname> from their default values, then replace
<filename>/opt/local</filename> with your <varname>prefix</varname>, replace
<filename>/Applications/MacPorts</filename> with your <varname>applications_dir</varname>, and/or add
your <varname>frameworks_dir</varname> to the list, respectively.</para>
<para>If you are running macOS 10.15 Catalina or later and have not disabled System Integrity Protection
(SIP), you will need to <link linkend="installing.macports.uninstalling.users">remove the
<filename>macports</filename> user</link> first.</para>
<programlisting><prompt>$</prompt> <userinput>sudo rm -rf \
<!-- --> /opt/local \
<!-- --> /Applications/DarwinPorts \
<!-- --> /Applications/MacPorts \
<!-- --> /Library/LaunchDaemons/org.macports.* \
<!-- --> /Library/Receipts/DarwinPorts*.pkg \
<!-- --> /Library/Receipts/MacPorts*.pkg \
<!-- --> /Library/StartupItems/DarwinPortsStartup \
<!-- --> /Library/Tcl/darwinports1.0 \
<!-- --> /Library/Tcl/macports1.0 \
<!-- --> ~/.macports</userinput></programlisting>
<para>If you use a shell other than bash (perhaps tcsh), you may need to adjust the above to fit your
shell's syntax.</para>
<para>Depending on which version of MacPorts you have and which ports you have installed, not all of the
above paths will exist on your system; this is OK.</para>
</section>
</section>
<section xml:id="installing.shell">
<title>MacPorts and the Shell</title>
<para>MacPorts requires that some environment variables be set in the shell. When MacPorts is installed using
the macOS package installer, a <quote>postflight</quote> script is run after installation that automatically
adds or modifies a shell configuration file in your home directory, ensuring that it defines variables
according to the rules described in the following section. Those <link
linkend="installing.macports.source">installing MacPorts from source code</link> must modify their
environment manually using the rules as a guide.</para>
<para>Depending on your shell and which configuration files already exist, the installer may use
<filename>.zprofile</filename>, <filename>.profile</filename>, <filename>.bash_login</filename>,
<filename>.bash_profile</filename>, <filename>.tcshrc</filename>, or <filename>.cshrc</filename>.</para>
<section xml:id="installing.shell.postflight">
<title>The Postflight Script</title>
<para>The postflight script automatically sets the <varname>PATH</varname> variable, and optionally the
<varname>MANPATH</varname> and <varname>DISPLAY</varname> variables according to the rules described
below. If a current shell configuration file exists at installation time it is renamed to
<quote>mpsaved_$timestamp</quote>. Those <link linkend="installing.macports.source">installing MacPorts
from source code</link> must modify their environment manually using the rules as a guide.</para>
<itemizedlist>
<listitem>
<para>Required: <varname>PATH</varname> variable</para>
<para>This variable is set by the postflight script to prepend the MacPorts executable paths to the
current path as shown. This puts the MacPorts paths at the front of <varname>PATH</varname>
so that the MacPorts binaries will take precedence over vendor-supplied binaries.</para>
<programlisting>export PATH=/opt/local/bin:/opt/local/sbin:$PATH</programlisting>
<note>
<para>The user environment's $PATH is not in effect while ports are being installed, because the
$PATH is scrubbed before ports are installed, and restored afterwards. To change the search
path for locating system executables (rsync, tar, etc.) during port installation, see the
<link linkend="internals.configuration-files.macports-conf">macports.conf</link> file
variable <varname>binpath</varname>. But changing this variable is for advanced users only,
and is not generally needed or recommended.</para>
</note>
</listitem>
<listitem>
<para>Optional: <varname>MANPATH</varname> variable</para>
<para>Condition: If prior to MacPorts installation a <varname>MANPATH</varname> variable exists in
a current <filename>.profile</filename> that contains neither the value
<filename>${prefix}/share/man,</filename> nor any empty items separated by a colon, the
postflight script sets the <varname>MANPATH</varname> variable as shown below. Otherwise, the
<varname>MANPATH</varname> variable is omitted.</para>
<programlisting>export MANPATH=/opt/local/share/man:$MANPATH</programlisting>
</listitem>
<listitem>
<para>Optional: <varname>DISPLAY</varname> variable</para>
<para>Condition: If installing on a Mac OS X version earlier than 10.5 (Leopard), and if a shell
configuration file exists at time of MacPorts installation without a <varname>DISPLAY</varname>
variable, the postflight script sets a <varname>DISPLAY</varname> variable as shown below. The
<varname>DISPLAY</varname> variable is always omitted on Mac OS X 10.5 or higher.</para>
<programlisting>export DISPLAY=:0.0</programlisting>
</listitem>
</itemizedlist>
</section>
<section xml:id="installing.shell.verifyprofile">
<title>Verify the Configuration File</title>
<para>To verify that the file containing the MacPorts variables is in effect, type <command>env</command> in
the terminal to verify the current environment settings after the file has been created. Example output
for <command>env</command> is shown below.</para>
<note>
<para>Changes to shell configuration files do not take effect until a new terminal session is
opened.</para>
</note>
<screen>MANPATH=
<!-- -->TERM_PROGRAM=Apple_Terminal
<!-- -->TERM=xterm-color
<!-- -->SHELL=/bin/bash
<!-- -->TERM_PROGRAM_VERSION=237
<!-- -->USER=joebob
<!-- -->__CF_USER_TEXT_ENCODING=0x1FC:0:0
<!-- -->PATH=/opt/local/bin:/opt/local/sbin:/bin:/sbin:/usr/bin:/usr/sbin
<!-- -->PWD=/Users/joebob
<!-- -->EDITOR=/usr/bin/pico
<!-- -->SHLVL=1
<!-- -->HOME=/Users/joebob
<!-- -->LOGNAME=joebob
<!-- -->DISPLAY=:0.0
<!-- -->SECURITYSESSIONID=b0cea0
<!-- -->_=/usr/bin/env</screen>
</section>
<section xml:id="installing.shell.editorvar">
<title>Optional Editor Variables</title>
<para>You can set an environment variable in order to use your favorite text editor with the <command>port edit</command>
command.</para> <para>MacPorts will check <varname>MP_EDITOR</varname>, <varname>VISUAL</varname> and
<varname>EDITOR</varname> in this order, allowing you to either use a default editor shared with other
programs (<varname>VISUAL</varname> and <varname>EDITOR</varname>) or a MacPorts-specific one
(<varname>MP_EDITOR</varname>).</para>
<para>For example, to use the nano editor, add this line to your bash config:</para>
<programlisting>export EDITOR=/usr/bin/nano</programlisting>
<para>To use the user-friendly GUI editor <link
xlink:href="https://www.barebones.com/products/bbedit/">BBEdit</link> (installation required),
add this line:</para>
<programlisting>export EDITOR=/Applications/BBEdit.app/Contents/Helpers/bbedit_tool</programlisting>
<para>To keep a command-line text editor as default while using BBEdit with portfiles, add
this:</para>
<programlisting>export EDITOR=/usr/bin/vi
<!-- -->export MP_EDITOR=/Applications/BBEdit.app/Contents/Helpers/bbedit_tool</programlisting>
</section>
</section>
</chapter>