Skip to content
byrnereese edited this page May 14, 2011 · 4 revisions

Installing Melody on a Mac OS System via Macports

This guide covers the procedures for installing Melody on a personal Mac computer.

Overview

What you will need

  • A Mac, MacBook, MacBook Pro, iMac, etc.
  • Administrative access
  • XCode installed
  • Macports installed

What will be done

Most Macs come pre-installed with many of the components you will need to run Melody, however, not all of them. This guide will take you through the process of installing the following components via MacPorts:

  • Perl
  • Some Apache2 modules
  • PHP5
  • MySQL
  • ImageMagick
  • Perl Modules

Then we will walk you through the process of editing your Apache configuration files to get everything up and running.

Installation and Setup Instructions

  1. Install your ports. Each of the following ports are to be installed using the following command:

     prompt> sudo port install port_name
    

    Install these ports (verbatim):

    • emacs [^1]
    • perl5.10 [^2]
    • apache2 +no_startupitems
    • php5 +apache2 +mysql5 +pear
    • php5-curl
    • php5-mcrypt
    • php5-mysql
    • php5-openssl
    • ImageMagick +perl
    • p5-crypt-ssleay
    • p5-dbi
    • p5-dbd-mysql
    • p5-error
    • p5-html-parser
    • p5-html-tagset
    • p5-locale-gettext
    • p5-test-simple
    • p5-uri
    • p5-cgi
    • p5-image-size
    • p5-soap-lite
    • p5-file-temp
    • p5-crypt-dsa
    • p5-xml-atom
    • p5-archive-tar
    • p5-archive-zip
    • mysql5 +server (see "Tips on Installing MySQL" below)

    [^1]: Unless of course you are a masochist and use vi. :) [^2]: The most recent version of Perl might be 5.12, so check first.

  2. Update Perl. With a newer version of Perl now installed on your system, you need to update your system to use it, in favor of the version of Perl that comes installed with your Mac. Execute these commands:

     prompt> sudo mv /usr/bin/perl /usr/bin/perl.orig
     prompt> ln -s /opt/local/bin/perl /usr/bin/perl
    
  3. Install additional Perl Modules. For each of the following Perl modules, you will need to execute the simple command sudo cpan <module name>. Some of the modules below have additional prerequisites, and some have a lot of them. Be sure to "follow" and install all necessary prerequisites. Pay close attention to what is output to the console and make sure all the perl modules are installed properly. If a module is not installed, resolve the issue prior to continuing. See Installing Perl Modules." Now, install these modules:

    • Bundle::CPAN
    • Convert::PEM
    • Crypt::DSA
    • Mail::Sendmail
    • IPC::Run
    • Cache::Memcached
    • Cache::Memcached::Fast
    • XML::XPath
    • JSON::XS

    This is the most time consuming part of the installation. So go get a coffee or something. Be careful not to leave the terminal unattended for too long though because it will prompt you from time to time.

  4. Download Melody. This part should be easy right?

  5. Install Melody. You will need to download the latest version of Melody from openmelody.org, and then copy the files into the proper location.

     prompt> cd ~/Downloads
     prompt> unzip melody-v1.0.0.zip
     prompt> cp -pR melody-v1.0.0 ~/Sites/melody
    
  6. Edit Your Apache Config.

    Edit this file: /private/etc/apache2/users/YOUR_USERNAME.conf

    And add the following to it:

     <Directory "/Users/YOUR_USERNAME/Sites/">
         Options Indexes MultiViews ExecCGI FollowSymLinks
         AllowOverride All
         Order allow,deny
         Allow from all
     </Directory>
    

    This will allow you to access Melody from the following URL to complete the installation:

     http://localhost/~YOUR_USERNAME/melody/
    

Tips on Installing MySQL

In theory, installing and setting up MySQL via macports should be as easy as:

prompt> sudo port install mysql5 +server

And when that is done, accessing it should be as simple as:

prompt> mysql -u root mysql

However, that is not always the case. A quick search on Google about installing MySQL via macports will reveal that it can be fraught with very enigmatic error messages. If you have trouble installing MySQL via macports then please contact our support community on Get Satisfaction where someone might be able to help you. In the meantime, we hope the following instructions will help you get up and running. Cross your fingers!

Follow these instructions immediately following the installation of MySQL via macports.

  1. Change your PATH and create some shortcuts for yourself.

     prompt> emacs ~/.profile
    

    Then add the following lines to the file:

     export PATH=/usr/local/bin:/usr/bin:/opt/local/lib/mysql5/bin:$PATH:/opt/local/bin
     alias mysql_start='sudo /opt/local/etc/LaunchDaemons/org.macports.mysql5/mysql5.wrapper start';
     alias mysql_stop='sudo /opt/local/etc/LaunchDaemons/org.macports.mysql5/mysql5.wrapper stop';
     alias mysql_restart='sudo /opt/local/etc/LaunchDaemons/org.macports.mysql5/mysql5.wrapper restart';
    
  2. Change Permissions of MySQL Files.

     prompt> sudo chown -R mysql:mysql /opt/local/var/db/mysql5
     prompt> sudo chmod u+rwx,go= /opt/local/var/db/mysql5
    
  3. Start MySQL.

     prompt> sudo /opt/local/etc/LaunchDaemons/org.macports.mysql5/mysql5.wrapper start
    
  4. Setup Initial MySQL Database(s)

     prompt> sudo /opt/local/lib/mysql5/bin/mysql_install_db --user=mysql
    

    This should work. If it doesn't; if you get a message like:

    Access denied for user 'root'@'localhost' (using password: NO)

    Then running this slight variant has been shown to work. But first, clear out your mysql database.

     prompt> sudo rm -rf /opt/local/var/db/mysql5/mysql
     prompt> sudo /opt/local/lib/mysql5/bin/mysql_install_db --user=_mysql
    
  5. Testing the Connection

    A pristine installation of MySQL should setup a user for you named "root" with no password. Therefore, connecting to MySQL should be as simple as:

     prompt> mysql -u root mysql
    

    If you get an error, then something is wrong and you should contact the Melody community for help. Otherwise, everything is ready to go!

 


Questions, comments, can't find something? Let us know at our community outpost on Get Satisfaction.

Credits

  • Author: Six Apart Ltd., Byrne Reese
  • Edited by: Violet Bliss Dietz
Clone this wiki locally