Installing Vanilla on Mac OS X

Thanks to the vanilla-pudding crew I have managed to get vanilla 0.5.2pre01 installed on to OS X. There was an unusual amount of fussing about, but we got there in the end and things have been fine since; now I just have to learn to get the most out of it!

Apache and Rebol

The first step we'll take is to make sure you have your Apache install working correctly by making sure the httpd.conf file (usually found in /etc/httpd/httpd.conf) is going to work, but also because we will be adding some things to it due to some inadequacies in the Rebol component of the vanilla installation.

I want to start here because once this is set up we can move exclusively to talking about vanilla. Firstly, be sure to enable both mod_env and mod_setenvif by uncommenting them in your httpd.conf file.

At the bottom of the file, you can add the following without the quote marks, but keeping the # mark:

"#patch reb2.5 setenv
DYLD_INSERT_LIBRARIES /usr/lib/libtermcap.dylib"

Using the download instructions on Chris' installation guide, I put Rebol in /usr/local/rebol/rebol directory (there's a song in there somewhere). After doing the following we'll see if Rebol is working. If you use the default terminal 'tcsh' it might be worthwhile adjusting the .tcshrc file in your home directory. This file is invisible, but of course you can get access to invisible items via a number of utilities out there, including and i'd recommend it, TinkerTool.

By adjusting the .tcshrc file we get to test out the Rebol component in the terminal, which you can do after adding the following:

setenv DYLD_INSERT_LIBRARIES /usr/lib/libtermcap.dylib

If you've added the above--fire up the terminal and type/paste:

/usr/local/rebol/rebol

if you received a message telling you it was creating a user.r file--Great!
If you received a message telling you stuff like tpt trap--Bummer!

This will have to do with file permissions and you should make sure the directory has write access. So if your name is johndoe you should choose the option with your name to have read and write access to the rebol application and the rebol folder, you could also include "staff (Me)" in the Group option.

If you've done this then try the terminal command again. Still not working? What are the privileges on your usr directory?

*vanilla*

OK, lets move on to Vanilla. I'm assuming you've downloaded vanilla and expanded the archive. Move "vanilla.r" and "vanilla.r.conf" to the "CGI-Executables" directory of your Apache installation (/Library/WebServer/CGI-Executables), and then move the "vanilla" folder to your /Library/WebServer/Documents directory.

In the CGI-Executables directory we're going to duplicate "vanilla.r" and rename it "vanilla-wrapped.r". Now we're going to take a look at the permissions on each of the files. "vanilla-wrapped.r" and "vanilla.r.conf" should have the Owner of the file being "yourname (Me)" and the Group should be "staff (Me)", the 'Others' setting should be "Read only". NB. ALL 'Others' settings for the vanilla installation files should be "Read only".

The first of these files we are going to edit is the "vanilla.r" file. Open it in a text editor such as BBEdit or whichever other text editor you prefer and delete the contents of the file and replace it with the following:

#!/bin/bash
export DYLD_INSERT_LIBRARIES=/usr/lib/libtermcap.dylib
/usr/local/rebol/rebol -cs /Library/WebServer/CGI-Executables/vanilla-wrapped.r

If you look on the third line you'll see that it points to the directory where rebol resides. If you have a different place for your rebol installation you will need to change that line to where you have placed it. Once you have done this and saved the changes we need to change the privileges on the "vanilla.r" file to Owner "www" and Group to "staff (Me)".

Now open the newly created "vanilla-wrapped.r" file and scroll down to a section of the file that begins with the following header:

; --- internal vanilla startup (config, libs/plugins) ---

Shortly after this should be a line that reads:

script-name: last parse sys-script-name "/"

replace this line, completely, with the following, including the quotes:

script-name: "vanilla.r"

You can now save the "vanilla.r" file and open "vanilla.r.conf".

Vanilla.r.conf

There is very little to do here, simply change the 'vanilla-root' to:

"/Library/WebServer/Documents/vanilla/"

which is where you put the vanilla folder right?

The 'vanilla-base-url': should look like this "http://127.0.0.1/cgi-bin/"

After that you can save the file and make sure the permissions have the following: Owner: yourname (Me) and Group: staff (Me).

Finally, and with much holding of breath, enter the following url into your browser: http://127.0.0.1/cgi-bin/vanilla.r

If you have everything working--Congratulations! If nothing is happening--Keep reading....we'll get you there!

Trouble Shooting

1. Vanilla is very serious about what permissions it has, be sure to triple check what they are.
2. Vanilla is also very serious about its path descriptors, is it possible you forgot that last ending back-slash in your vanilla.r.conf file?
3. Rebol can be a bit picky with OS X. One option is to open your invisible environment.plist in (/Users/yourname/.MacOSX/environment.plist with either the Developer Tools 'Plist Editor' or with a text editor. if it's a text editor, you can add the following to the plist:

<key>DYLD_INSERT_LIBRARIES</key>
<string>/usr/lib/libtermcap.dylib</string>

or add the following in the editor: (the capitals go in the left field, and the path goes in the right field) DYLD_INSERT_LIBRARIES /usr/lib/libtermcap.dylib

4. Have you checked the permissions again?
5. Be sure to double-check directory and file names.
6. Make sure your httpd.conf file includes the ability to do cgi scripts.

If you're still in trouble drop the folks at the vanilla-pudding list a line.