Skip to content

Instantly share code, notes, and snippets.

@ilg-ul
Last active November 4, 2016 09:29
Show Gist options
  • Save ilg-ul/6d8b28df15c42576e2d8d3a9d2980eb7 to your computer and use it in GitHub Desktop.
Save ilg-ul/6d8b28df15c42576e2d8d3a9d2980eb7 to your computer and use it in GitHub Desktop.
Install MacPorts (DEPRECATED)
#!/usr/bin/env bash
# -----------------------------------------------------------------------------
# Safety settings (see https://gist.github.com/ilg-ul/383869cbb01f61a51c4d).
if [[ ! -z ${DEBUG} ]]
then
set -x # Activate the expand mode if DEBUG is anything but empty.
fi
set -o errexit # Exit if command failed.
set -o pipefail # Exit if pipe failed.
set -o nounset # Exit if variable not set.
# Remove the initial space and instead use '\n'.
IFS=$'\n\t'
# -----------------------------------------------------------------------------
# https://guide.macports.org/chunked/installing.macports.html
MP_VERSION="2.3.4"
MP_PREFIX="$HOME/opt/macports-gae"
MP_BUILD_FOLDER="$HOME/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}"
caffeinate make
echo "If asked, enter sudo password."
sudo rm -rf "${MP_PREFIX}"
mkdir "${MP_PREFIX}"
sudo make install
sudo chown -R $(id -n -u):$(id -n -g) "${MP_PREFIX}"
export PATH="${MP_PREFIX}/bin":"${MP_PREFIX}/sbin":$PATH
caffeinate port -v selfupdate
caffeinate sudo port install python27
caffeinate port install libtool automake autoconf pkgconfig wget cmake boost \
libconfuse swig-pytho texinfo texlive
# To use MacPorts, add something like this to ~/.profile
echo alias mpg=\'export PATH=${MP_PREFIX}/bin:\$PATH\'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment