Overview

On June 6, 2005, Apple formally announced the coming switch to the Intel processor, as well as the Developer Transition Kit (an intel mac with development software and preview releases). Fast forward to one year later. Intel based Mac notebooks and mini’s have been out in the hands of the public for several months. Many application vendors including major ones like Adobe, the former Macromedia, and Microsoft have yet to deliver even beta versions of many of their products for Intel based macs.

I find the lack of an Adobe JRun or CFMX port a little troubling. There is very little C code involved in these applications, being Java based, and Java runs great on the Intel Macs.

In fact, JRun and CFMX can be made to run very nicely on the Intel Macs. By mostly bypassing the C/C++ code, and where that’s not an option a straight recompile seems to do the job (mod_jrun), CFMX runs extremely fast on a MacBook Pro.

This guide does require some level of comfort with a command prompt, compiling code, modifying config files, dealing with apache issues, and understanding unix permissions. If this sounds even remotely scary or difficult to you, you’ll probably want to wait for a supported version. (CF8).


Disclaimer

The intent of this is guide it to walk you through the installation and configuration of CFMX Developer Edition on an Intel based Mac. I developed this guide on my own personal MacBook Pro. I can’t guarantee any of this will actually work for you, and if you hose your machine or loose data following these instructions, it’s nobody’s fault but your own. Please back up any files before you edit them!

Please also note that nothing in this guide is supported or endorsed by Adobe.


Index

  1. Downloads
  2. Install
  3. Compile the Apache HTTPD/JRun4 Connector
  4. Configure JRun to use the Connector
  5. Manually configure Apache
  6. Start/Restart Services
  7. MySQL DataSource Setup
  8. Multiple Instances
  9. Conclusion

Downloads

You will need the following downloads:

  • Apple Developer Tools (XCode)
  • CFMX 7 (Developer Edition)
  • Lingon
  • JRun OEM SDK (full version, not platform specific)
  • MySQL Connector-J (optional)
    note: more recent versions are available, but do not seem to work correctly. 3.1.10 is the last version known to work properly with CFMX, and support MySQL 5 advanced features, such as stored procedures.

Install

  1. Install the Developer Tools
    • Perform a full, default install. I know it’s large, but it works. Cherry picking components has caused folks problems.
  2. Install CFMX 7.02.
    • The installer runs under Rosetta (PPC Emulation), but works just fine.
    • Do not install the startup script.
    • Do use the multi-server configuration.
    • Do use the built-in web server.
  3. Install Lingon
    • take a few minutes to familiarize yourself with the user interface.
  4. JRun OEM SDK
    • warning: do not use stuffit! This must be uncompressed from the command line.
    • this doesn’t have an installer, so for now, just move it to it’s own folder.
    • create a jrun_sdk folder, and move the zip file to it.
  5. MySQL Connector-J
    • no installer here either, just unzip the archive (stuffit’s ok)
    • Copy the mysql-connector-java-3.1.10-bin.jar into /Applications/JRun4/servers/cfusion/cfusion-ear/
      cfusion-war/WEB-INF/cfusion/lib

Verify the Installation

The first thing we need to check is that we can actuall launch CF. To do this, open up a terminal window, and enter the following command:

1
2
3
4
sudo /System/Library/Frameworks/JavaVM.framework/Versions/1.4.2/Home/bin/java 
-server -Djava.awt.headless=true 
-jar /Applications/JRun4/lib/jrun.jar 
-start cfusion

If everything is installed properly, you should be able to browse to
http://127.0.0.1:8300/CFIDE/Administrator/,
where you should be able to complete the installation, and access the admin.


Setup Lingon

Launch Lingon. Fire up the assistant, which will walk you through setting up CF as a daemon (service). A the “What do I want to do” screen, select “Run a job at startup” (the default), and click Next. On the next screen, the label can be anything you want, but something descriptive such as “CFMX Service” would be appropriate. Uncheck “Launch only when I log in”, and check “Must run as root” (the server will start for all users, and be started by root). Click Next. The last step is to enter the job, which will be the same as the command we started above, but without the “sudo”, so:

1
2
3
4
/System/Library/Frameworks/JavaVM.framework/Versions/1.4.2/Home/bin/java 
-server -Djava.awt.headless=true 
-jar /Applications/JRun4/lib/jrun.jar 
-start cfusion

In Lingon, the Load, Unload, and Reload buttons will act to start, stop, and restart ColdFusion.


Compile the Apache HTTPD/JRun4 Connector

If you’re running a regular Mac OS X installation, you have Apache 1.3 already installed. If you’re running Mac OS X Server, you have Apache 1.3 and/or 2.0. Some folks may have a self-compiled Apache 2.1 or Apache 2.2, or possibly a third-party build. That’s over 4 different versions of Apache to support, so building modules for all these can be a bit sticky. This guide currently presents instructions for compiling the module for Apache 1.3, as I only have access to a single machine (Macbook Pro) running a non-server OS X install. Steven Ross has a blog entry on how he was able to successfully get things going with Apache 2.2, which should translate fairly well for Apache 2.

I would distribute my binary, but I don’t know that it’s legal, nor would it necessarily work with your machine. So you’re going to have to compile the connector yourself. Fortunately it’s not all that difficult to do, if you’ve ever compiled apache from source, or any other apache modules, this shouldn’t be too difficult for you. The difficult part was locating the source code for the module. It used to be distributed along with CFMX, but in recent releases it’s been left out. Turns out there’s an “OEM” kit for JRun4 (as you now know), that has what we need.

Open a terminal, and cd into the folder where the JRun OEM SDK is located. Once there, from the command line, issue the command unzip -a jrun4-sdk.zip. The -a is a critical piece, don’t miss it. Now, cd into src/connectors/src. This is where the connector source code is located. This needs unzipped in the same manner: unzip -a ApacheModule.zip. Now the source code is available for you to compile.

Compiling the source code utilizes the Apache apxs command line utility which will configure the source for your specific Apache installation. I’m using the bundled Apache web server that’s enabled with Personal Web Sharing, via the Sharing System Preference Pane. The command line is:

1
apxs -c -Wc,-w mod_jrun.c jrun_maptable_impl.c jrun_property.c jrun_session.c platform.c jrun_mutex.c jrun_proxy.c jrun_utils.c

This will chug away for a bit, and when it’s done, you’ll have a mod_jrun.so file. This should not take a long time to run at all. These Core Duo and Core 2 Duo Intel processors are very quick. Unless you’re already using up all your available system memory, and are recording video to disk or something, it should only take a few seconds.

The last step is to copy the .so file to the location apache puts it’s modules:

1
sudo cp mod_jrun.so /usr/libexec/httpd

This isn’t strictly necessary — the .so can be put anywhere on your local filesystem, and Apache can find it as long as it’s referenced correctly in Apache’s configuration. I prefer to keep everything together however.


Configure JRun to use the Connector.

This is the part I hate. The manual configuration of JRun and Apache has to be done because wsconfig is fairly broken under OS X Intel.

This bit involves disabling the built-in web server (optional), and enabling the connector proxy service. To do this, edit the /Applications/JRun4/servers/cfusion/SERVER-INF/jrun.xml You’ll need to change a few entries.

To disable the web server (optional), we need to find the section around line 408 that looks something like this:

1
2
3
4
5
6
7
8
9
10
11
12
13
  <service class="jrun.servlet.http.WebService" name="WebService">
     <attribute name="activeHandlerThreads">25</attribute>
     <attribute name="backlog">500</attribute>
     <attribute name="interface">*</attribute>
 
     <attribute name="keepAlive">false</attribute>
     <attribute name="maxHandlerThreads">1000</attribute>
     <attribute name="minHandlerThreads">1<attribute>
     <attribute name="port">8300</attribute>
 
     <attribute name="threadWaitTimeout">300</attribute>
     <attribute name="timeout">300</attribute>
   </service>

Inside of that service tag, we need to add an attribute named deactivated, and set it to true. If the attribute already exists for you, you’ll just need to change it to true. The resulting code should look something like this (the change being bolded):

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
   <service class="jrun.servlet.http.WebService" name="WebService">
 
      <attribute name="activeHandlerThreads">25</attribute>
      <attribute name="backlog">500</attribute>
      <attribute name="interface">*</attribute>
      <attribute name="deactivated">true</attribute>
 
      <attribute name="keepAlive">false</attribute>
      <attribute name="maxHandlerThreads">1000</attribute>
      <attribute name="minHandlerThreads">1</attribute>
      <attribute name="port">8300</attribute>
 
      <attribute name="threadWaitTimeout">300</attribute>
      <attribute name="timeout">300</attribute>
   </service>

If you choose not to disable the built-in web server, you will be able to access the coldfusion admin via the http://localhost:8300/CFIDE/Administrator/ URL even if there’s a problem with your apache configuration. This can come in handy in determining why CF is not working (is it apache, or is it cf?). If CF isn’t working via the built-in webserver, something is seriously wrong with CF.

The change to enable the connector proxy is also in the jrun.xml. In fact, it should be in the next section, looking like this:

1
2
3
4
5
6
   <service class="jrun.servlet.jrpp.JRunProxyService" name="ProxyService">
      <attribute name="activeHandlerThreads">25</attribute>
      <attribute name="backlog">500</attribute>
 
      <attribute name="deactivated">true</attribute>
      <attribute name="interface">*</attribute>

Just change the deactivated attribute to false, like so:

1
2
3
4
5
6
   <service class="jrun.servlet.jrpp.JRunProxyService" name="ProxyService">
 
      <attribute name="activeHandlerThreads">25</attribute>
      <attribute name="backlog">500</attribute>
      <attribute name="deactivated">false</attribute>
      <attribute name="interface">*</attribute>

There’s one last thing to do to configure JRun, and that’s setup the server store and wsconfig.properties. You’ll need to create the /Applications/JRun4/lib/wsconfig directory, and create a “1″ directory underneath it. Inside the wsconfig directory, create a wsconfig.properties file. It’s just a text file, and it’s contents should be something like this:

1
2
1=Apache,/etc/httpd,"","",""
1 .srv=localhost,"server1"

Inside the new “1″ directory, create a new jrunserver.store file (again, just a text file). That file should look something like this:

1
proxyservers=127.0.0.1:51020

Note that your port (default 51020), may be different. This can be determined from the JRunProxyService section of the jrun.xml file you edited eariler, if the default doesn’t work for you. This is highly unlikely however.

That’s it for setting up JRun, so on to Apache!


Manually Configure Apache

Since wsconfig does not work with OS X Intel (it doesn’t recognize any web servers as supported), we’re going to have to configure Apache manually. To modify the configuration of the system web server, you’ll need to edit the /etc/httpd/httpd.conf file, as root. To do this, you can sudo emacs /etc/httpd/httpd.conf, or temporarily change the permissions on the file (using sudo chown/chmod), or figure out how to launch your favorite text editor as root.

The module needs to be defined and loaded before we can do anything with it. This will require adding an AddModule Line and a LoadModule line. Look through your httpd.conf, and find the two sections. At the bottom of each, add the appropriate version of these two lines:

1
2
LoadModule jrun_module libexec/httpd/mod_jrun.so
AddModule mod_jrun.c

Now we need to configure the module. Note that your bootstrap port (default 51020) may be different. This can be determined from the JRunProxyService section of the jrun.xml file you edited eariler, if the default doesn’t work for you. After the end of the AddModule section of the httpd.conf, add the following:

1
2
3
4
5
6
7
8
9
<IfModule mod_jrun.c>
   JRunConfig Verbose false
   JRunConfig Apialloc false
   JRunConfig Ssl false
   JRunConfig Ignoresuffixmap false
   JRunConfig Serverstore /Applications/JRun4/lib/wsconfig/1/jrunserver.store
   JRunConfig Bootstrap 127.0.0.1:51020
   AddHandler jrun-handler .jsp .jws .cfm .cfml .cfc .cfr .cfswf
</IfModule>

It’s handy to be able to access the coldfusion administrator and cfdocs, so we’ll need to add some aliases. Doing it this way, if you have multiple virtual hosts, and multiple cf instances, you can keep the cfadmin in one location, which makes upgrading easier. Locate the section of the httpd.conf where the Alias /icons line is, and add the following:

1
2
3
4
5
6
7
8
9
10
11
Alias /CFIDE/ "/Applications/JRun4/servers/cfusion/cfusion-ear/cfusion-war/CFIDE/"
Alias /cfide/ "/Applications/JRun4/servers/cfusion/cfusion-ear/cfusion-war/CFIDE/"
Alias /CFIDE/Administrator/ "/Applications/JRun4/servers/cfusion/cfusion-ear/cfusion-war/CFIDE/administrator/"
Alias /cfdocs/ "/Applications/JRun4/servers/cfusion/cfusion-ear/cfusion-war/cfdocs/"
 
<Directory "/Applications/JRun4/servers/cfusion/cfusion-ear/cfusion-war">
   Options Indexes MultiViews
   AllowOverride None
   Order allow,deny
   Allow from all
</Directory>

Last but not least for our Apache configuration, we want to be able to go to http://localhost/~user/, and have it automatically load up an index.cfm file. Simply find the DirectoryIndex line, and add index.cfm to it, something like this:

1
    DirectoryIndex index.cfm index.php index.html dochome.htm

That’s it for the apache configuration!


Start/Restart Services

In Lingon, reload your CFMX User Daemon. In the Sharing System Preference, enable Personal Web Sharing if it’s disabled, or turn it off and then back on if it is enabled. If you start it, and it stops at “starting”, and never starts, you have a problem with your apache configuration. Once you correct the problems, you will need to either reboot your machine, or start apache from the command line.

Finally, after everything is up and running, go to http://127.0.0.1/CFIDE/Administrator/, you should be able to log in using the password you specified during the CFMX installation.


MySQL DataSource Setup

Well my dear readers, consider this a bonus for having gotten this far. I know not everybody will be using MySQL, but it’s popular enough I thought it was important to include. Want to use mysql 5, with all the nice features? Well, if you followed the install instructions for MySQL Connector-J, you
will be able to.

Create a new datasource, and for the driver, select “other”. For the JDBC Url, use “jdbc:mysql://[host]:[port]/[database]” (replacing [host], [port], and [database] with the appropriate values. For Driver Class and Driver name, use “com.mysql.jdbc.Driver”. Everything else (including login and password), is like a normal datasource setup.


Multiple Instances

Rather than duplicate the effort, Stephen Collins, author of the The ACME Guide,has documented on his blog what’s required to get this going. Thanks Stephen!


Conclusion

Well, by now you’re probably bored to tears, asking yourself “why, oh why did I inflict this pain upon myself?”. If you made it through, then I welcome you to the wonderful world of CFMX on MacIntel. I can’t believe I wrote this whole thing!

If you find any errors, omissions, or typo’s, or have any suggestions for improving this document, please don’t hesitate to let me know.

So long for now, and thanks for all the CF!

Mark