Web DevCenter
oreilly.comSafari Books Online.Conferences.
MySQL Conference and Expo April 14-17, 2008, Santa Clara, CA

Sponsored Developer Resources

Web Columns
Adobe GoLive
Essential JavaScript
Megnut

Web Topics
All Articles
Browsers
ColdFusion
CSS
Database
Flash
Graphics
HTML/XHTML/DHTML
Scripting Languages
Tools
Weblogs

Atom 1.0 Feed RSS 1.0 Feed RSS 2.0 Feed

Learning Lab






ColdFusion MX on Mac OS X, Part 3
Pages: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11

Acquire the gnutar Utility

We need to expand the cfmxinst.bin file that we compressed under Linux. We would normally use the corresponding tar command in Mac OS X. Unfortunately, the tar command is an older version (part of the Unix OS) that has some known deficiencies. One of these affects us: when expanding, tar will truncate any path names greater than 100 characters. Linux and some other Unix systems use a later version of tar named: gnutar. We need to acquire this program for Mac OS X.

If you have installed the Mac OS X Developer Tools, gnutar is already installed. To verify this, open the Terminal program, found in the folder:

Applications ==> Utilities

Enter:

ls -l /usr/bin/gnutar

If gnutar is present, you should see something like:

-rwxr-xr-x 1 root wheel 181532 Jul 12 04:27 /usr/bin/gnutar

If gnutar is not present, you could download and install the Apple Developer Tools from the Mac OS X Development Web site. Membership is free and you'll find lots of good resources there.

Alternatively, there is relational database management system named OpenBase, which is available for Mac OS X and includes gnutar. A free trial version is available at the OpenBase Web Site.

You can download and install OpenBase per the manufacturer's instructions.

Install ColdFusion MX on Mac OS X

We will now install a copy of the same ColdFusion MX system that we installed on Linux, onto Mac OS X.

  1. Open a Mac OS X Terminal window.

  2. We need to assume the identity of the root user to install the CFMX files: Enter the following, and your Mac OS X user password (when prompted):

    su root
  3. Make sure we are at the file system root level. Enter:

    cd /
  4. Expand the cfmxinst.bin file containing the entire ColdFusion MX Linux installation.

    Authors Note: The following commands can be entered on two lines, as shown, because the \ character preceding the newline, "escapes" the newline (makes it inoperative).

    If you have the Apple Developer Tools installed, enter the following:

    /usr/bin/gnutar -xvzf \
      /Users/cfmx/Public/Drop\ Box/cfmxinst.bin

    If you downloaded OpenBase, enter the following:

    /Library/OpenBase/bin/gnutar -xvzf \
       /Users/cfmx/Public/Drop\ Box/cfmxinst.bin

    The names of all the files being expanded will scroll through the display (notice the nice long path names). After a few moments, the operation will complete and the command-line prompt will display.

  5. Now, reassume the cfmx user identity, Enter:

    su cfmx
  6. ColdFusion MX for Linux ships with a developer version of the PointBase database system. It is used in the example programs and documentation code snippets. We need to make a copy of the PointBase driver and put it where the Mac OS X Java can find it. In the finder navigate (through our nice new CFMX installation) to:

    opt ==> coldfusionmx ==> runtime ==> 
      servers ==> lib

    Copy the PointBase jdbc driver: pbserver42RE.jar to

    Library ==> Java ==> Extensions

    You may see other items in this folder.

  7. We can't use the supplied shell script to start and stop CFMX because it launches an Intel C++ program. Instead, we have our own shell script, thanks to Christian Cantrell.

    Author's Note: Christian Cantrell is a Java developer who works with Flash and ColdFusion primarily as a hobby. He manages a team of Java/JSP programmers for a company called Amazing Media in Fairfax, VA. He does as much work as he can on his Mac (OS X exclusively). He is the co-author of Flash Enabled (New Riders) and is currently working on Flash Remoting, The Definitive Guide (O'Reilly) with Mike Chambers.

    Copy the shell script below into a text editor (I use BBEdit) and save it to:

    opt ==> coldfusionmx ==> bin

    as coldfusionosx

    Note: Make sure:

    • that the very first line of the file is not blank, but contains the #!/bin/sh starting in column 1.
    • to save the file with Unix line feeds.
    #!/bin/sh
    
    # Set some environment variables.
    CF_DIR=/opt/coldfusionmx
    EX_DIR=/Library/Java/Extensions
    
    # Starts CFMX.
    function startColdfusion() {
      proc_id=`getProcess`
      if test $proc_id 
      then
        echo "CFMX is already running as process \
          ${proc_id}."
        exit 1
      fi
      echo "Starting CFMX..."
      #java -jar $CF_DIR/lib/cfusion.jar -start \ 
      #  default > $CF_DIR/logs/cfserver.log 2>&1 &
      java -jar $CF_DIR/lib/cfusion.jar -start \
        default &
      sleep 3
      proc_id=`getProcess`
      you=`whoami`
      echo "CFMX started by ${you} as process \
        ${proc_id} with extensions:" 
      cur_dir=`pwd`
      cd $EX_DIR
      for jars in `ls -1 *.jar`
      do
        echo "  - $jars"
      done
      cd $cur_dir
    }
    
    # Stops CFMX.
    function stopColdfusion() {
      proc_id=`getProcess`
      if test -z $proc_id 
      then
        echo "CFMX is not running."
        exit 1
      fi
      echo "Stopping CFMX..."
      kill -HUP $proc_id 
      sleep 3
      echo "CFMX stopped."
    }
    
    # Prints this command's usage.
    function usage() {
      echo "Usage: coldfusionosx start|stop|restart" 
    }
    
    # Returns CFMX's process id, if it's running. 
    function getProcess() {
      ps -auxww | grep "cfusion.jar -start default" \
        | grep -v grep | awk '{print $2}'
    }
    
    # Check to make sure we are on a Macintosh.
    if test `uname -p` != powerpc
    then
      echo "This script is for Macintosh OS X only."
      exit 1
    fi
    
    # Check to make sure an argument was passed in.
    if test -z $1
    then
      usage
      exit 1
    fi
    
    # Handle the command argument.
    if test $1 = stop
    then
      stopColdfusion
      exit 0
    elif test $1 = start
    then
      startColdfusion
      exit 0
    elif test $1 = restart
    then
      stopColdfusion
      sleep 5
      startColdfusion
      exit 0
    else
      usage
      exit 0
    fi
  8. Make the shell script executable. Enter:

    chmod 755 /opt/coldfusionmx/bin/coldfusionosx

Pages: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11

Next Pagearrow