Installation of MySource Matrix on Mac OS 10.4 with MAMP and PostgreSQL
-----------------------------------------------------------------------
Hi there,
I recently installed MySource Matrix for testing and development on a standard Mac OS 10.4 installation with MAMP and the PostgreSQL package at http://www.postgresqlformac.com/.
Here are the steps I took to getting it working with this configuration.
Set up PostgreSQL
-----------------
- Download the unified installer from http://www.postgresqlformac.com/ (found on the left hand nav pane about half way down the page). I used v8.2.4.
- Unpack and run the Server installer (there is no need to unpack the Client or Developer files). It will install PostgreSQL into /Library/PostgreSQL8 which is not unix-like but will still suffice for our purposes. It will also plant itself in /Library/StartupItems but you can delete the instance there if you do not want it to start up with Mac OS.
- Navigate to terminal and check to see if postgres is currently running by using "top".
- If it is, great - you can proceed to the next section. If it isn't you will have to start it. The postgres unified installer sets up all required users on your Mac system. Before you can use any of these postgres commands, you will need to switch to the postgres user by typing, "su - postgres".
- Still in terminal, navigate to /Library/PostgreSQL8/bin and type "./pg_ctl start -D …/data". /Library/PostgreSQL8/data is where this installation of postgres keeps its database directory. You can also run "./pg_ctl --help" for other options which you can use to control your installation of postgres. For now, all you need to do is ensure that the postgres daemon has started.
- Follow instructions on http://www.postgresqlformac.com/ by using your recently installed postgres tools located in /Library/PostgreSQL8/bin.
Preparing Apache, Pear and PHP
------------------------------
- Instead of messing around with Apple’s pre-installed versions of Apache, Pear and PHP, you can drop the MAMP bundle into your /Applications folder which will have most things we need already neatly set up for you. To download it, go to http://www.postgresqlformac.com/ and download just the standard MAMP. You don’t really need MAMP Pro.
- Unpack and drop it into your /Applications folder.
Setting up Pear modules
-----------------------
- Bear in mind that MySource Matrix only suppports PHP4 at this stage. With that in mind, it is time to set up all required Pear packages needed by MySource Matrix.
- My version of MAMP (1.4.1) did not have a working version of php4 pear and from scouring the MAMP forums, it seems this is a common issue. The simple fix is to copy the /Console and /Archive directories in /Applications/MAMP/bin/php5/lib/php to /Applications/MAMP/bin/php4/lib/php
- Next, navigate to /Applications/MAMP/bin/php4/bin and compare your output of “./pear list” with the required packages listed in http://www.postgresqlformac.com/. Then it’s just a matter of typing: “./pear install <package name>” until you have all the required packages.
- You will probably run into issues with Mail_Mime spitting out stuff like “pear/Mail_Mime requires PEAR Installer (version >= 1.6.0), installed version is 1.4.9”. The solution is to go to http://www.postgresqlformac.com/ and download and unpack manually into /Applications/MAMP/bin/php4/lib/php/Mail.
- NOTE: It is very important that you always use MAMP's php4 pear installation and not OSX's pear which can be invoked by just typing "pear". Always ensure that you are running MAMP's version by prefixing the "./" to ensure that you are running "pear" in the current directory and not the system wide version.
- Once you have got all pear packages installed you can now proceed to configuring MySource Matrix.
Configure MySource Matrix
-------------------------
- It's probably a good time to ensure that MAMP is running in the background. Launch the MAMP control panel from /Applications/MAMP in Finder. Click on "Preferences", click on the "PHP" tab and ensure that the PHP version is "PHP 4".
- Download and unpack MySource Matrix into your directory of choice. I unpacked into /Users/Basil/Sites/mysource_matrix. Wherever your unpack it into, ensure that your MAMP Apache settings correspond. Do this by going into MAMP's preferences and clicking on the "Apache" tab. Specify your document root folder accordingly. E.g. my document root folder is /Users/Basil/Sites.
- Now you can begin to follow the instructions on http://www.postgresqlformac.com/ with one caveat. You must always use MAMP’s php4 version of php located in /Applications/MAMP/bin/php4/bin. E.g. you would execute step 1 by typing: “/Applications/MAMP/bin/php4/bin/php install/step_01.php .” provided you were already in /Users/Basil/Sites/mysource_matrix.
Apache aliases
--------------
- You will need to edit MAMP's httpd.conf file located in /Applications/MAMP/conf/apache.
- Since MAMP uses port 8888 to run its instance of Apache, you must ensure that any virtual hosts you set up include this port number. As well ensure that you are using fully-qualified domain names, i.e. "127.0.0.1." rather than just simply "localhost".
- As an example, here is my configuration:
[codebox]
<VirtualHost *:8888>
DocumentRoot /Users/Basil/Sites/mysource_matrix/core/web
ServerName 127.0.0.1.
<Directory "/Users/Basil/Sites/mysource_matrix">
Options Indexes FollowSymLinks
Order deny,allow
Deny from all
</Directory>
<Directory "/Users/Basil/Sites/mysource_matrix/core/web">
Options Indexes FollowSymLinks
Order allow,deny
Allow from all
</Directory>
<Directory "/Users/Basil/Sites/mysource_matrix/core/lib">
Options Indexes FollowSymLinks
Order allow,deny
Allow from all
</Directory>
<Directory "/Users/Basil/Sites/mysource_matrix/data/public">
Options Indexes FollowSymLinks
Order allow,deny
Allow from all
</Directory>
<Directory "/Users/Basil/Sites/mysource_matrix/fudge">
Options Indexes FollowSymLinks
Order allow,deny
Allow from all
</Directory>
Alias "/__data" "/Users/Basil/Sites/mysource_matrix/data/public"
Alias "/__lib" "/Users/Basil/Sites/mysource_matrix/core/lib"
Alias "/__fudge" "/Users/Basil/Sites/mysource_matrix/fudge"
Alias "/" "/Users/Basil/Sites/mysource_matrix/core/web/index.php/"
</VirtualHost>
[/codebox]
- Also ensure that your SQ_CONF_SYSTEM_ROOT_URLS variable in data/private/conf/main.inc corresponds to your virtual host settings. E.g. define('SQ_CONF_SYSTEM_ROOT_URLS', '127.0.0.1:8888');
- Restart Apache from MAMP's control panel because we have made changes to httpd.conf.
- You can then start using your development version of MySource Matrix by navigating to http://www.postgresqlformac.com/ and logging in with username: root, password: root.
Uninstall
---------
- To uninstall, all you need to do is trash the MAMP folder in /Applications and trash PostgreSQL from /Library and /Applications. Simple, clean and easy.