Ticket #60556: installing a bootstrap version of MacPorts and using it for modern SSL.txt

File installing a bootstrap version of MacPorts and using it for modern SSL.txt, 6.6 KB (added by kencu (Ken), 4 years ago)

installing a bootstrap version of MacPorts and using it for modern SSL.txt

Line 
1Installing MacPorts with updated security:
2
3By default, MacPorts will install using the libraries and headers that come with your OS, in /usr/include and /usr/lib. However, on older systems these libraries have not been updated in some time, and now many https websites that distribute source code and binaries have enabled security features that these older libraries cannot manage. This causes failures during the "fetch" stage of ports, often with a message involving a "TLS" error to indicate the unsupported security protocols.
4
5To upgrade your MacPorts installation on older systems to have modern security, and therefore access these https sites without troubles, you can reinstall MacPorts, building against newer dependencies. A simple way to do that is to use a second "bootstrap" installation of MacPorts to install the needed dependencies for you.
6
7Note: this takes longer to read than to actually accomplish, as it has been described very fully here to try to avoid any misunderstandings.
8
9
10Part 1:
11
12Installing a bootstrap installation of MacPorts:
13
14First, make sure you are not working with your previously installed version of MacPorts, if there is one. To do this:
15
16edit ~/.profile
17
18and disable the added PATH settings that pointed to MacPorts in /opt/local by commenting the line out with a hashtag, and then add a new PATH setting for what will be your new MacPorts installation in /opt/bootstrap (which may not yet exist, but that's OK):
19
20#export PATH="/opt/local/bin:/opt/local/sbin:$PATH"
21export PATH="/opt/bootstrap/bin:/opt/bootstrap/sbin:$PATH"
22
23close and reopen the Terminal window to pick up the new settings.
24
25
26Now go to a suitable directory, download, extract, and configure MacPorts with configure settings appropriate to the bootstrap installation. You will need to set the prefix to /opt/bootstrap, make sure that any ports that install bits into the Applications directory don't overwrite the ones you install with your primary MacPorts installation by placing the Applications directory somewhere safe, and you also don't want to add any startupitems that might interfere with your primary MacPorts installation:
27
28./configure --prefix=/opt/bootstrap --with-applications-dir=/opt/bootstrap/Applications --without-startupitems && make && sudo make install
29
30After installation, on 10.4 to 10.8, to set up the bootstrap version of MacPorts appropriately:
31
32edit macports.conf with your favourite editor, eg:
33
34bbedit /opt/bootstrap/etc/macports/macports.conf
35
36and add this line at the top:
37
38cxx_stdlib              libstdc++
39
40Forcing cxx_stdlib to libstdc++ not only simplifies the bootstrap installation significantly, but it also prevents the bootstrap installation from accidentally overwriting /usr/lib/libc++.dylib.
41
42Now check to make sure all is well:
43
44$ which port
45/opt/bootstrap/bin/port
46
47$ port -v
48MacPorts 2.6.2
49Entering shell mode... ("help" for help, "quit" to quit)
50
51and "quit".
52
532.6.2 is current at that time of this writing.
54
55Next, use this bootstrap installation to install the updated dependencies that your primary MacPorts installation will use:
56
57sudo port -v sync
58sudo port -v install curl
59
60This will pull in the other needed packages your primary MacPorts installation will use to have modern security. On Tiger, you will also pull in the apple-gcc42 compiler installation, which proceeds smoothly but unfortunately does add both time and bulk to the bootstrap installation. There are ways to work around this, but not simply described here, so I suggest just let it play out.
61
62Maintenance of the bootstrap repo:
63
64From time to time (at least every three months) you should update the bootstrap installation. To do this:
65
66again edit your path in ~/.profile (helps keep things straight):
67
68#export PATH="/opt/local/bin:/opt/local/sbin:$PATH"
69export PATH="/opt/bootstrap/bin:/opt/bootstrap/sbin:$PATH"
70
71close and reopen a Terminal window to pick up the new PATH, and then update as usual:
72
73sudo port selfupdate && sudo port -v -N upgrade outdated
74
75You can clean out the older updated ports by running
76
77sudo port -v reclaim
78
79but I suggest you don't remove the first screenful of unrequested build dependencies you will be presented with, as you will just need them all again next time you update; just remove the deactivated ports and the no-longer-required distfiles.
80
81If you are the meticulous sort like I am, you can set all the build dependencies as "requested" and then port reclaim won't suggest to uninstall them for you each the time. The process to do that is described completely in MacPorts' guide:
82
83https://guide.macports.org/chunked/using.common-tasks.html#using.common-tasks.keeplean
84
85Now you have a relatively lean set of current libraries in /opt/bootstrap that your primary MacPorts installation can use to build against.
86
87
88Part 2:
89
90Installing MacPorts using the updated libraries in /opt/bootstrap.
91
92Now we will install MacPorts using the newer SSL dependencies, and you might as well use the most current sqlite3 as well, as it is there to be used too. You can just overwrite your current MacPorts installation, should there be one...it is not necessary to uninstall MacPorts in /opt/local and reinstall it again.
93
94Now that we're done working with /opt/bootstrap, reset your PATH again:
95
96edit your path in ~/.profile
97
98export PATH="/opt/local/bin:/opt/local/sbin:$PATH"
99#export PATH="/opt/bootstrap/bin:/opt/bootstrap/sbin:$PATH"
100
101and then close and reopen a Terminal window to pick up the new PATH settings.
102
103Decompress the MacPorts tarball as usual for a source installation, and then we'll now configure it to use the new libraries. Helpfully, MacPorts has configure arguments available that simplify the process of using the alternate libraries.
104
105
106./configure --with-curlprefix=/opt/bootstrap --with-sqlite3prefix=/opt/bootstrap && make && sudo make install
107
108IMPORTANT: Once you have installed it in /opt/local, MacPorts will prompt you to run "sudo port -v selfupdate". Before you do that, please note:
109
110MacPorts does not yet have a mechanism to record the configure arguments that were used to invoke it originally. If you run "sudo port -v selfupdate" and a new version of MacPorts is available, it will build with the default arguments and your newer libraries in /opt/bootstrap will be ignored. Until a fix for this gets incorporated into base, you should to do this instead:
111
112sudo port -v sync
113
114This command downloads new Portfiles, but skips upgrading MacPorts. When a new version of MacPorts is released, you will need to use the configure arguments manually at present, to build it from source against your updated libraries.
115
116If you accidentally do run "sudo port -v selfupdate" and install MacPorts with older security, there is no harm done; you can just reinstall right over top of that again from a source tarball.