Changes between Version 17 and Version 18 of howto/InstallingOlderPort


Ignore:
Timestamp:
Aug 19, 2015, 6:50:15 AM (9 years ago)
Author:
ryandesign (Ryan Carsten Schmidt)
Comment:

rewrote; removed instructions for manually downloading from repository using Trac, in favor of using svn; addressed how to disable default variants

Legend:

Unmodified
Added
Removed
Modified
  • howto/InstallingOlderPort

    v17 v18  
    44
    55 * Audience: Anyone needing an older version of a port than is currently available in the repository or installed on their machine
    6  * Requires: MacPorts >=1.7
     6 * Requires: MacPorts >= 1.7
    77
    8 == Introduction ==
    98
    10 When you upgrade an installed port, MacPorts deactivates the older version but keeps it installed. For example:
     9== Introduction == #intro
     10
     11MacPorts maintainers strive to give you the latest version of software in each port, but you may wish to use an older version for various reasons. How to do this depends on whether you still have the older version installed.
     12
     13Installing an older version of a port is not the intended way to use MacPorts, is not usually recommended, and may cause various problems. It's fine to do this in the course of trying to identify a problem, but once you have determined that a newer version is broken and that an older version works, please inform the developers of the affected software of the problem so that they can fix it, so that you can soon go back to using the latest versions of the software.
     14
     15
     16== Reactivating an older version that's still installed == #reactivate
     17
     18When you upgrade an installed port, MacPorts deactivates the older version but keeps it installed. For example, assume tcl @8.4.16_0 is installed:
    1119
    1220{{{
    1321$ port installed tcl
    1422The following ports are currently installed:
    15   tcl @8.4.16_0(active)
     23  tcl @8.4.16_0 (active)
     24}}}
     25
     26When you upgrade, a newer version of tcl will be installed and activated, while tcl @8.4.16_0 will remain installed but will be deactivated:
     27
     28{{{
    1629$ sudo port upgrade tcl
    1730[snip]
     
    2033  tcl @8.4.16_0
    2134  tcl @8.5.0_0 (active)
    22 $
    2335}}}
    2436
    25 If you later discover you would like to go back to the older version, you can activate it, which will automatically deactivate the active version first:
     37As long as it is still installed, you can reactivate tcl @8.4.16_0, which will automatically deactivate the active version first:
    2638
    2739{{{
     
    2941--->  Deactivating tcl @8.5.0_0
    3042--->  Activating tcl @8.4.16_0
    31 $
    3243}}}
     44
     45And similarly you can go back to the newer version.
    3346
    3447Once you're confident the new version works to your satisfaction, you can uninstall the old one to reclaim disk space:
     
    3851}}}
    3952
    40 If you want to go back to an older version after you've already uninstalled it, or to an older version than you've ever had installed, you can do so by manually downloading the older version of the portfile from the Subversion repository.
     53Note:
     54if you used the `-u` flag when you upgraded the port (i.e. `sudo port -u upgrade tcl`), MacPorts would uninstall the inactive versions after activating the latest one, so you would not be able to reactivate them later.
     55Use `-u` when you know in advance that you will not want to go back to an older version, or you don't mind taking the extra steps below to reinstall the older version later if needed.
    4156
    42 == Installation ==
    4357
    44 === Step 1: '''Finding the right revision''' ===
    45 To install an older version of the port, you'll have to manually download the files from the repository. [browser:trunk/dports Browse the repository] to find the directory of the port you want, then use the Revision Log link in the upper right to find the older version that you want to install. For example, if you wanted to install the older 8.4.16 version of tcl, browse to the [browser:trunk/dports/lang/tcl lang/tcl] directory and look at its [log:trunk/dports/lang/tcl revision log]. Here you'll note that tcl was updated to 8.5.0 in r32235, so you want the revision before that, which was r30810. Click the [browser:trunk/dports/lang/tcl@30810 @30810] link in the revision log (not the [30810] link) to see the directory as it existed in that revision.
     58== (Re)installing an older version that's no longer installed == #install
    4659
    47 === Step 2: '''Getting the Portfile''' ===
    48 Click the Portfile to see it, then download it to disk using the Original Format link at the bottom of the page. The tcl port doesn't have a `files` directory, but if it did, you should download each file within it as well, and place them in a `files` directory on your disk in the same place where you downloaded the Portfile.
     60If you want to go back to an older version after you've already uninstalled it, or to install an older version of a port that predates when you first installed it, you can do so by manually downloading the older version of the portfile and any associated files from the MacPorts Subversion repository.
    4961
    50 MacPorts usually runs under a separate "macports" user account with reduced privileges;
    51 you must place the Portfile (and files directory, if any) in a place where the "macports" user can read them.
    52 In particular, your home directory is not usually readable by other users, so inside your home directory is not a suitable location;
    53 using an unsuitable location will result in an error message like `Error: Unable to execute port: could not read "/Users/someuser/Desktop/Portfile": permission denied`.
    54 If you don't mind the OS deleting these files after a few days, or after a restart, you could put them in /tmp, or you could create another directory elsewhere (e.g. at the root of your hard drive) for this purpose.
     62=== Step 1: '''Find the right revision''' ===
     63To install an older version of the port, you'll have to get the necessary files from the repository.
     64[browser:trunk/dports Browse the repository] to find the directory of the port you want, then use the Revision Log link in the upper right to find the older version that you want to install.
     65For example, if you wanted to install the older 8.4.16 version of tcl, browse to the [browser:trunk/dports/lang/tcl lang/tcl] directory and look at its [log:trunk/dports/lang/tcl revision log].
     66Here you'll note that tcl was updated to 8.5.0 in !r32235, so you want the revision before that, which was !r30810.
     67(You can also just subtract one from the revision you found, e.g. !r32235 - 1 = !r32234.)
     68If desired, you can click the [browser:trunk/dports/lang/tcl@30810 @30810] link in the revision log (not the [30810] link) to see the directory as it existed in that revision.
    5569
    56 === Step 3: '''Building the downloaded port''' ===
    57 Finally, use the Terminal to `cd` to the directory where you downloaded the Portfile and type "`sudo port install`".
     70=== Step 2: '''Get the port directory''' ===
     71In the Terminal, using the revision number, port category and port name, check out the port's directory at the desired revision using the `svn` command:
     72{{{
     73$ svn checkout -r 30810 https://svn.macports.org/repository/macports/trunk/dports/lang/tcl
     74}}}
     75This creates a "tcl" directory in your current location, and populates that with everything the port needs to build.
     76Replace "30810" and "lang/tcl" with the correct revision and category/portname for the port you're interested in.
    5877
    59 == Alternative method to getting the port ==
     78Note:
     79Subversion is included with Mac OS X 10.5 and later but you may want to get a newer version by installing the subversion port;
     80Mac OS X 10.4 does not include subversion, so users of that system must install the port:
    6081
    61 Subversion can be used as well to fetch an older port, and is simpler for one that has a files/ subdirectory.
     82{{{
     83$ sudo port install subversion
     84}}}
    6285
    63 === Step 1: '''Install Subversion''' ===
     86Note:
     87MacPorts usually runs under a separate "macports" user account with reduced privileges, so you must check out the port's directory in a place where the macports user can read them.
     88The directories Desktop, Documents, Downloads, Library, Movies, Music, and Pictures, which OS X created in your home directory when your user account was created, have permissions that prevent other users (including the macports user) from looking inside them, so these are ''not'' suitable locations.
     89Using an unsuitable location will result in an error message like `Error: Unable to execute port: Could not open file: /Users/username/Desktop/portname/Portfile`.
     90So instead, create a new directory in your home directory (such as "macports") in which to store these port directories.
     91Or you could create another directory elsewhere (e.g. at the root of your hard drive) for this purpose.
     92If you don't mind the OS deleting these files after a few days, or after a restart, you could put them in /tmp.
     93If you really want to put the port directory in one of the mentioned directories in your home directory, and you don't mind other users on your system reading your files (e.g. if your computer is used by only one person), you could change the permissions of the desired directory from 0700 (`drwx------`) to 0755 (`drwxr-xr-x`).
    6494
    65 Install Subversion:
     95=== Step 3: '''Build the downloaded port''' ===
     96Finally, change to the directory you checked out with Subversion (which contains the Portfile) and install the port, omitting the port name:
     97
    6698{{{
    67 sudo port install subversion
     99$ cd tcl
     100$ sudo port install
    68101}}}
    69 This step is optional for Mac OS X 10.5 Leopard and later, which already include a Subversion client, but you may want to install it from MacPorts anyway because its version is likely newer than the one included with your operating system.
    70102
    71 === Step 2: '''Finding the right revision''' ===
    72 Follow Step 1 earlier to find the right revision for the port you need, e.g. r30810.
    73103
    74 === Step 3: '''Checking out the port''' ===
    75 Using the revision number, port category and port name, check out the port directory at that revision using the `svn` command:
     104=== Specifying a variant === #variant
     105
     106To enable a variant, specify it as usual. For example, to install the port in the current directory enabling the quartz variant:
     107
    76108{{{
    77 svn co -r 30810 http://svn.macports.org/repository/macports/trunk/dports/lang/tcl
     109$ sudo port install +quartz
    78110}}}
    79 This creates a tcl directory in your current location, and populates that with everything the port needs to build.  Replace "30810" and "lang/tcl" with the correct revision and category/portname for the port you're interested in.
    80111
    81 == An example ==
    82 The following shows a complete example:
     112To disable a variant that's on by default, you must also first use the `--` argument. For example, to install the port in the current directory disabling the x11 variant:
     113
     114{{{
     115$ sudo port install -- -x11
     116}}}
     117
     118
     119=== Specifying a subport === #subport
     120
     121Some Portfiles—including those for python modules, perl modules, php modules, and others—contain subports. For example, a python module has subports for each version of Python it supports. To specify which subport you want, set the "`subport`" variable. For example to install the py27-pylint subport of the py-pylint portfile:
     122
     123{{{
     124$ cd py-pylint
     125$ sudo port install subport=py27-pylint
     126}}}
     127
     128Make sure you specify the subport exactly as shown at the top of the output of `port info`. MacPorts [ticket:34619 will not warn or notify you] if you misspell a subport name or request a subport that does not exist.
     129
     130
     131=== Another example === #example
    83132
    84133{{{port info php5}}} shows it to be first in the '''lang''' category, so it would be located in lang/php5.
    85134
    86 After browsing [log:trunk/dports/lang/php5 php5's history], 5.3.0 was introduced in r53563 which means the previous revision, r53555, was the last update for 5.2.10.  With this information, we can run
     135After browsing [log:trunk/dports/lang/php5 php5's history], 5.3.0 was introduced in r53563 which means the previous revision, r53555, was the last update for 5.2.10.  With this information, we can run:
     136
    87137{{{
    88 svn co -r 53555 http://svn.macports.org/repository/macports/trunk/dports/lang/php5
    89 cd php5
    90 sudo port install +apache2+postgresql83
     138$ svn checkout -r 53555 https://svn.macports.org/repository/macports/trunk/dports/lang/php5
     139$ cd php5
     140$ sudo port install -- +apache2 +postgresql83
    91141}}}
    92142
    93143After this, php5 version 5.2.10 should be installed.
    94144
    95 == Specifying a subport ==
    96 
    97 Many python libraries, for example, have separate ports for different python versions, but a single port file to describe them all. To specify which version you want, use "subport=...". For example:
    98 
    99 {{{
    100 cd dports/python/py-pylint
    101 sudo port install subport=py27-pylint
    102 }}}
    103145
    104146[wiki:howto <- Back to the HOWTO section]