Last active
November 5, 2016 10:12
-
-
Save ilg-ul/439b0a8fe844ae4d551f to your computer and use it in GitHub Desktop.
Install MacPorts in /opt/macports from sources.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
if [[ ${DEBUG} != "" ]]; then | |
set -x | |
fi | |
set -o errexit | |
set -o pipefail | |
set -o nounset | |
IFS=$'\n\t' | |
# https://gist.github.com/ilg-ul/383869cbb01f61a51c4d | |
# ---------------------------------------------------------------------------- | |
# https://guide.macports.org/chunked/installing.macports.html | |
MP_VERSION="2.3.4" | |
MP_PREFIX="/opt/macports" | |
MP_BUILD_FOLDER="~/Work/MacPorts" | |
mkdir -p "${MP_BUILD_FOLDER}" | |
cd "${MP_BUILD_FOLDER}" | |
rm -rf "MacPorts-${MP_VERSION}" | |
curl "https://distfiles.macports.org/MacPorts/MacPorts-${MP_VERSION}.tar.bz2" | tar -x -v -f - | |
cd MacPorts-${MP_VERSION} | |
# Play safe, exclude possible trouble sources from PATH. | |
export PATH=/bin:/sbin:/usr/bin:/usr/sbin | |
./configure --prefix="${MP_PREFIX}" | |
make | |
echo 'Enter sudo password' | |
# Potentially dangerous! | |
sudo rm -rf "${MP_PREFIX}" | |
sudo mkdir "${MP_PREFIX}" | |
sudo make install | |
export PATH="${MP_PREFIX}/bin":"${MP_PREFIX}/sbin":$PATH | |
sudo port -v selfupdate | |
# To use MacPorts, add something like this to ~/.profile | |
# alias mp='export PATH=/opt/macports/bin:/opt/macports/sbin:$PATH' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment