Getting Started
Bill Hernandez
ms at mac-specialist.com
Sat Sep 6 18:22:04 PDT 2008
On Sep 5, 2008, at 3:13 PM, Sam Williams wrote:
> Pardon my ignorance, but I can't find out how to begin using MacPorts.
>
> I have a MacBook just under a year old, with a 2GHz Intel Core 2 Duo
> processor and OS X 10.5.4.
>
> I installed appropriate versions of X11, Xcode & MacPorts - all
> successfully, as I understood it.
>
> I cannot find MacPort's icon.
>
> Perhaps it is not its own app. In which case it is a bit beyond my
> ken. ...my barbie too.
>
> I've checked the online guide & FAQ and it all seems to assume this
> most basic how-to-start-using-it point is self-evident and I can't
> find any mention of what I need to do to begin doing anything else
> with it. I've given up on that route, after a couple hours of
> installing and searching.
>
> Began this whole process in an attempt to install GIMP. I'll try
> the other easy(?) route listed on their site, but would still be
> interested in checking out what-all MacPorts has to offer. It seems
> an exciting source to explore.
>
> I am not computer-illiterate, by any means - I used to program in
> Fortran, RPN & Basic, from the early 70s to the mid-80s - but I am
> only a propeller-head wannabe and have been spoiled by Macs for the
> last 24 years. I suspect this is at the core of my problem.
>
> Damn, I'm getting old...
>
> Any help would be appreciated.
>
> TIA,
>
> SamW
Sam,
There is no MacPorts icon, but don't despair...
The first thing to do is select "/Applications/Utilities/Terminal.app"
and drag it to the dock where you can access it easily. After you
launch the Terminal from the dock, to make sure MacPorts is installed
you can try :
~ $ which port
---> /opt/local/bin/port
~ $ port help
'port help' will fill the Terminal window, but won't help you much, if
at all.
You can try :
~ $ sudo port -d selfupdate
This previous command will update MacPorts itself. The '-d' means do
the update in the "debug mode". i.e. echo boatloads of info to the
screen, you can also use '-v' which stands for "verbose mode".
Your best bet is to purchase 'PortAutority.app' and slowly begin to
learn about MacPorts with the goal to eventually do most everything
with the Terminal. For me it has a lot more power, but took a while to
figure out.
Google 'macports documentation' and that should give you several
places to begin.
Checkout :
http://www.macports.org/
http://guide.macports.org/
Try Google 'macports php'as an example and you'll find some links to
help
You can Google 'PortAutority.app', buy it, it will get you up and
going quickly. It's a bargain...
Once you install a few items with 'PortAutority.app' you can use the
Terminal to issue some commands like :
~ $ port installed
~ $ port list installed
About the same time, or shortly thereafter, that I started with
MacPorts I got hit by a Trojan Horse that damaged, several machines,
including servers, etc. This forced the shutdown, isolation, re-
initialization of the OS on all the machines, backups, etc. It took a
while to get all the issues resolved, until I finally found and
eradicated the trojan.
One of the biggest problems I ran into when I started was that anytime
I installed the operating system on any of the machines, it took a lot
of time to get all the ports installed, initialized, and running
(particularly the databases). Eventually I wrote a shell script that
installs, initializes all the databases, creates symlinks, makes
backups of things like php.ini, my.cnf, pg_hba.conf, httpd.conf, all
the apache virtual host files, etc.
I do not keep any of the php.ini, my.cnf, pg_hba.conf, httpd.conf, all
the apache virtual host files, etc. in the standard locations within '/
opt/local/...', instead I keep all the configuration files in another
directory unrelated to '/opt/local/...', thus the reason for the
symlinks. The nice thing about this is that if anything gets majorly
hosed for whatever reason, I can run the shell script which backs up
the databases, shuts down everything, deletes the '/opt/local/...'
directory, re-installs MacPorts, and all the ports I need, re-
initializes everything, restarts all the apache and associated pieces,
restores the databases, and for the most part everything is back up
and running very quickly. This was an important goal for me, to
automate rebuilding all the MacPorts installs.
I have gotten a lot of help on this board, it has been great. I mostly
lurk as there are others that know far more, but this seemed like
something I could reply to...
Depending on your needs, you will most likely need some variants which
provide additional functionalities to some of the ports.
Whatever you do, don't give up on MacPorts, it is an awesome, and
successful effort by some amazingly talented, and dedicated people to
help the rest of us ordinary mortals...
I added a couple of small shell scripts below for you, they may be
overkill for you now, but at least you'll have them for later...
Best of luck,
Bill Hernandez
Plano, Texas
# --+---------+---------+---------+---------+---------+---------
+---------+---------+---------+---------+
# Here's a small shell script that will help you get variant info :
# --+---------+---------+---------+---------+---------+---------
+---------+---------+---------+---------+
#!/bin/bash
#Author - Bill Hernandez (Plano, Texas)
# ScriptName - bh_port_variants v_1.0.0
# Modified - Thursday, September 13, 2007 (7:59 PM)
#
# make sure you save this in your shell search path
# make sure you set the permissions so that the owner is executable
# something like chmod 700 /path/to/bin/folder/bh_port_longdesc
# This assumes you have BBEdit as a Text Editor, if you don't have it www.barebones.com
has a free version that is almost as powerful
# if you call it without passing it a port name, it will you give you
info on Apache
# port variants Apache2
divider
='-----------------------------------------------------------------'
# --+---------+---------+---------+---------+---------+---------
+---------+---------+---------+---------+
# BEGIN CODE HERE
# --+---------+---------+---------+---------+---------+---------
+---------+---------+---------+---------+
if [ $# -lt 1 ]; then
fsubj=apache2 ;
else
fsubj=$1 ;
fi
apath=/Applications/BBEdit.app ;
output_file=/tmp/${fsubj}_port_long_desc.txt ;
debug_mode=true
today="[`date +%Y.%d.%m`](`date +%I:%M%p`)"
filepath=$0
dirpath=`dirname $filepath`
script=$(basename $filepath)
os_info=`uname -a`
os=$(uname -a | awk '{print $1 " " $3}')
domain=$(uname -a | awk '{print $2}')
username=$(id -u -n)
if [ $debug_mode == true ]; then
echo $divider > $output_file ;
echo "( 1 )" "called : $script $@" >> $output_file
echo $divider >> $output_file ;
echo "( 2 )" $today >> $output_file
echo "( 3 )" "\$username : ${username}" >> $output_file
echo "( 4 )" "\$filepath : " $filepath >> $output_file
echo "( 5 )" "\$dirpath : " $dirpath >> $output_file
echo "( 6 )" "\$script : " $script >> $output_file
echo "( 7 )" "\$os : " $os >> $output_file
echo "( 8 )" "\$domain : " $domain >> $output_file
echo "( 9 )" "\$os_info : " $os_info >> $output_file
echo $divider >> $output_file ;
fi
port variants $fsubj >> $output_file ;
echo $divider >> $output_file ;
port info long_description:$fsubj >> $output_file ;
open -a $apath $output_file
# --+---------+---------+---------+---------+---------+---------
+---------+---------+---------+---------+
# Here's a small shell script that will help the long description for
a given port :
# It may be overkill for now
# --+---------+---------+---------+---------+---------+---------
+---------+---------+---------+---------+
#!/bin/bash
#Author - Bill Hernandez (Plano, Texas)
# ScriptName - bh_port_ldesc --> bh_port_longdesc v_1.0.0
# Modified - Thursday, September 13, 2007 (7:59 PM)
#
# make sure you save this in your shell search path
# make sure you set the permissions so that the owner is executable
# something like chmod 700 /path/to/bin/folder/bh_port_longdesc
# This assumes you have BBEdit as a Text Editor, if you don't have it www.barebones.com
has a free version that is almost as powerful
# if you call it without passing it a port name, it will you give you
info on Apache
if [ $# -lt 1 ]; then
fsubj=apache ; apath=/Applications/BBEdit.app ; fpath=/tmp/$
{fsubj}_port_long_desc.txt ; port info long_description:$fsubj >>
$fpath ; open -a $apath $fpath
else
fsubj=$1 ; apath=/Applications/BBEdit.app ; fpath=/tmp/$
{fsubj}_port_long_desc.txt ; port info long_description:$fsubj >>
$fpath ; open -a $apath $fpath
fi
# --+---------+---------+---------+---------+---------+---------
+---------+---------+---------+---------+
# This is far from complete, but it will give you some idea
# --+---------+---------+---------+---------+---------+---------
+---------+---------+---------+---------+
#!/bin/bash
# ScriptName : bh_port_install_part_01
# Version : 1.0.0
# Author : Bill Hernandez
# Updated : Wednesday, April 16, 2008 (10:18 AM)
bh_port_install_part_01
# SEE : bh_port_install_all
# SEE : port_installed_2007_08_19.txt
# SEE : port_complete_install_log.txt
# SEE : port_pgsql_install_log.txt
# SEE : port_install_notes.txt
# [2008.02.05](12:19AM) -> [roscoe] ~ $ port list installed
#
# apache2 @2.2.8 www/apache2
# apr @1.2.12 devel/apr
# apr-util @1.2.12 devel/apr-util
# bison @2.3 devel/bison
# bzip2 @1.0.5 archivers/bzip2
# curl @7.18.1 net/curl
# cyrus-sasl2 @2.1.21 security/cyrus-sasl2
# db44 @4.4.20 databases/db44
# expat @2.0.1 textproc/expat
# fontconfig @2.5.0 graphics/fontconfig
# freetype @2.3.5 print/freetype
# gawk @3.1.6 lang/gawk
# gd2 @2.0.35 graphics/gd2
# gettext @0.17 devel/gettext
# gmake @3.81 devel/gmake
# jpeg @6b graphics/jpeg
# libiconv @1.12 textproc/libiconv
# libmcrypt @2.5.8 devel/libmcrypt
# libpng @1.2.26 graphics/libpng
# libtool @1.5.26 devel/libtool
# libxml2 @2.6.31 textproc/libxml2
# libxslt @1.1.22 textproc/libxslt
# m4 @1.4.10 devel/m4
# mhash @0.9.9 devel/mhash
# mysql5 @5.0.51a databases/mysql5
# ncurses @5.6 devel/ncurses
# ncursesw @5.6 devel/ncursesw
# openldap @2.3.35 databases/openldap
# openssl @0.9.8g devel/openssl
# ossp-uuid @1.6.0 devel/ossp-uuid
# pcre @7.6 devel/pcre
# perl5.8 @5.8.8 lang/perl5.8
# php5 @5.2.5 www/php5
# pkgconfig @0.23 devel/pkgconfig
# postgresql83 @8.3.1 databases/postgresql83
# postgresql83-doc @8.3.1 databases/
postgresql83-doc
# postgresql83-server @8.3.1 databases/
postgresql83-server
# readline @5.2.007 devel/readline
# rpl @1.4.0 textproc/rpl
# sqlite3 @3.5.8 databases/sqlite3
# tidy @20051026 www/tidy
# tiff @3.8.2 graphics/tiff
# zlib @1.2.3 archivers/zlib
#
# [2008.02.05](12:19AM) -> [roscoe] ~ $
#
# +---------+---------+---------+---------+---------+---------
+---------+---------+
# MACPORTS INSTALLATION ORDER - THIS IS HOW I INSTALLED THEM
# +---------+---------+---------+---------+---------+---------
+---------+---------+
# sudo port -d sync
# sudo port -d selfupdate
# bh_port_variants apache2
sudo echo
install_all=true
if [ $install_all == true ]; then
sudo port -v install zlib
sudo port -v install openssl
sudo port -v install gd2
sudo port -v install libxml2
sudo port -v install perl5.8
sudo port -v install rpl
sudo port -v install curl
sudo port -v install apr
sudo port -v install apr-util
sudo port -v install bison
sudo port -v install cyrus-sasl2
sudo port -v install libmcrypt
sudo port -v install libxslt
sudo port -v install mhash
sudo port -v install openldap
sudo port -v install pcre
sudo port -v install tiff
fi
sudo port -d install apache2
sudo port -v install sqlite3
sudo port -v install postgresql83-server
sudo port -v install postgresql83-doc
sudo port -v install postgresql83
sudo port -v install mysql5 +server
sudo port -d install php5 +apache2 +fastcgi +tidy +mysql5
+postgresql83 +sqlite +ipc +pcntl +pear +readline +sockets
# +---------+---------+---------+---------+---------+---------
+---------+---------+---------+---------+
# TO RE-INSTALL APACHE DO THE FOLLOWING
# +---------+---------+---------+---------+---------+---------
+---------+---------+---------+---------+
# open /opt/local
# +---------+---------+---------+---------+---------+---------
+---------+---------+---------+---------+
# SHUTDOWN THE SERVERS
# +---------+---------+---------+---------+---------+---------
+---------+---------+---------+---------+
# sudo launchctl unload -w /Library/LaunchDaemons/
org.macports.slapd.plist
# sudo launchctl unload -w /Library/LaunchDaemons/
org.macports.postgresql83-server.plist
# sudo launchctl unload -w /Library/LaunchDaemons/
org.macports.mysql5.plist
# sudo launchctl unload -w /Library/LaunchDaemons/
org.macports.apache2.plist
# +---------+---------+---------+---------+---------+---------
+---------+---------+---------+---------+
# UNINSTALL PHP AND APACHE2
# +---------+---------+---------+---------+---------+---------
+---------+---------+---------+---------+
# sudo port -v uninstall php5 +darwin_9 +macosx +apache2 +fastcgi
+tidy +mysql5 +postgresql83 +sqlite +ipc +pcntl +pear
# sudo port clean --all php5 +darwin_9 +macosx +apache2 +fastcgi +tidy
+mysql5 +postgresql83 +sqlite +ipc +pcntl +pear
# sudo port -v uninstall apache2
# sudo port clean --all apache2
# sudo port -v uninstall mysql5
# sudo port clean --all mysql5
# +---------+---------+---------+---------+---------+---------
+---------+---------+---------+---------+
# INSTALL PHP, MYSQL, PGSQL AND APACHE2
# +---------+---------+---------+---------+---------+---------
+---------+---------+---------+---------+
# sudo port -v install php5 +apache2 +fastcgi +tidy +mysql5
+postgresql83 +sqlite +ipc +pcntl +pear
# +---------+---------+---------+---------+---------+---------
+---------+---------+---------+---------+
# INITIALIZE THE DATABASES, httpd.conf, my.cnf, pg_hba.cong, php.ini,
etc
# +---------+---------+---------+---------+---------+---------
+---------+---------+---------+---------+
# +---------+---------+---------+---------+---------+---------
+---------+---------+---------+---------+
# START THE SERVERS
# +---------+---------+---------+---------+---------+---------
+---------+---------+---------+---------+
# sudo launchctl load -w /Library/LaunchDaemons/org.macports.slapd.plist
# sudo launchctl load -w /Library/LaunchDaemons/
org.macports.postgresql83-server.plist
# sudo launchctl load -w /Library/LaunchDaemons/
org.macports.mysql5.plist
# sudo launchctl load -w /Library/LaunchDaemons/
org.macports.apache2.plist
# +---------+---------+---------+---------+---------+---------
+---------+---------+---------+---------+
More information about the macports-users
mailing list