Install OpenERP 5.0.14 Client & Server on Mac OS X 10.5-6!

Here comes how.

FWD

Table of Contents

Introduction
Step 0 - Preparations
Step 1 - If not already done, install the latest versions of the Xcode tools, MacPorts, and XQuartz
Step 2 - Install py26-gtk using MacPorts
Step 3 - Install the PostgreSQL Database Server and initialize the database cluster
Step 4 - Install the additional Python dependencies for OpenERP-Server and OpenERP-Client
Step 5 - Installation and first start of OpenERP Server & Client 5.0.14 from its Linux sources
Step 6 - Adjustments on the X11 defaults, launch daemon startup scripts for the servers, application wrapper for the client
Author
Copyright Notice and Terms of Use

 

openerp screen

 

TOC FWD

Introduction

Two years ago, I installed TinyERP 4 Client/Server on Mac OS X Server 10.4 and the installation log was published at the TinyERP site. Unfortunately TinyERP did not work out for the project that I was working on at that time, and now I wanted to explore a little bit OpenERP 5 at my favorite computing platform which is Mac OS X.

The principle installation steps of OpenERP 5 on Mac OS X 10.5-6 are quite similar to TinyERP 4 on Mac Os X 10.4, but there are so many differences in the fine deatails, that it was necessary to write-up the installation instructions completely new.

I spent some time to evaluate the different methods of providung Python-GTK+ for the Mac. I installed GTK+2 and the Python bindings completely from actual sources. I checked out GTK-OSX, and finally I tested GTK+2 provided by MacPorts. Only Python-GTK+2 from MacPorts was without issues, so here I will discribe the installation by the way of MacPorts. Below procedure has been proven to work on a PowerBook G4 (ppc) and on a MacBook (i386).

I am in no way affiliated with OpenERP. I just installed OpenERP and since I believe in the Open Source philosophy, I felt obligated to report my installation log.

 

BWD TOC FWD

Step 0 - Preparations

  • Open a new Terminal window and create an Installation directory in your home directory.

       mkdir ~/Installation
       cd ~/Installation
    
  • Add to the bash profile file at /etc/profile the path to the PostgreSQL ../bin and ../man files and the path to the MacPorts ../bin, ../sbin and ../man files

       sudo nano /etc/profile
    

    If not already there add the following lines to the respective sections:

       export PATH=${PATH}:/usr/local/pgsql/bin
       export PATH=${PATH}:/opt/local/bin:/opt/local/sbin
    
       export MANPATH=${MANPATH}:/usr/local/pgsql/share/man
       export MANPATH=${MANPATH}:/opt/local/man
    

 

BWD TOC FWD

Step 1 - If not already done, install the latest versions of the Xcode tools, MacPorts, and XQuartz

  • Download the Xcode tools 3.1.4 and install the Xcode binaries with the package installer. The download of the 1 GB disk image may take a while.
  • Download the latest version of MacPorts and install it from the provided binary package.
  • Download the latest version of XQuartz and install it from the provided binary package.

 

BWD TOC FWD

Step 2 - Install py26-gtk using MacPorts

  • Open a new Terminal window and let MacPorts run a self update.

       sudo port -v selfupdate
    
  • Edit the MacPorts configuration file to prevent building errors because of invalid architecture:

       sudo nano /opt/local/etc/macports/macports.conf
    

    replace

       #build_arch   i386
    

    with:

       build_arch
  • Now MacPorts should be ready to install py26-gtk and most of the python dependencies. Be prepared that this may take several hours, depending on the speed of your internet connection and your Mac model.

       sudo port install py26-numpy -atlas
       sudo port install py26-gtk
       sudo port install py26-libxslt
       sudo port install py26-lxml
       sudo port install py26-xml
       sudo port install py26-pydot
       sudo port install py26-reportlab
       sudo port install py26-mx-base
    

 

BWD TOC FWD

Step 3 - Install the PostgreSQL Database Server
and initialize the database cluster

  • Still in the Terminal window, enter superuser mode and create the PostgreSQL User & Group:

       sudo -s
    
       dscl . -create /groups/pgsql
       dscl . -create /groups/pgsql gid 301
       dscl . -create /groups/pgsql realname "PostgreSQL Users"
       dscl . -create /groups/pgsql name pgsql
       dscl . -create /groups/pgsql passwd "*"
       
       dscl . -create /users/pgsql
       dscl . -create /users/pgsql uid 301
       dscl . -create /users/pgsql gid 301
       dscl . -create /users/pgsql name pgsql
       dscl . -create /users/pgsql realname "PostgreSQL User"
       dscl . -create /users/pgsql shell /bin/sh
       dscl . -create /users/pgsql home /var/pgsql
       dscl . -create /users/pgsql passwd "*"
       dscl . -create /users/pgsql expire 0
       dscl . -create /users/pgsql change 0
    

    Leave the superuser mode now.

       exit
    
  • For PostgreSQL Download and Installation, enter in Termial the following command sequence:

       curl -L "http://wwwmaster.postgresql.org/redir/198/f/source/v8.4.3/postgresql-8.4.3.tar.gz" -o postgresql-8.4.3.tar.gz
       tar --no-same-owner -xzf postgresql-8.4.3.tar.gz
       cd postgresql-8.4.3
       export CC=gcc-4.2
       export CFLAGS=-Os
       ./configure --prefix=/usr/local/pgsql --enable-thread-safety --with-openssl --with-perl --with-python
       make
       rm -rf /usr/local/pgsql
       sudo make install
       make clean
       cd ..
    
  • Enter superuser mode and create the PostgreSQL enveloping data directory:

       sudo -s
       mkdir -p /var/pgsql
       chown pgsql:pgsql /var/pgsql
       chmod 700 /var/pgsql
    

    Create the database cluster:

       sudo -u pgsql /usr/local/pgsql/bin/initdb -A md5 -E UTF8 -W -D /var/pgsql/data
    

    Note, there will be a dialog asking for the password. Enter and confirm the pgsql master PASSWORD there.
    Then the PostgreSQL Server is ready for its first start:

       sudo -u pgsql /usr/local/pgsql/bin/postgres -e -D /var/pgsql/data &
    

    Leave the superuser mode now.

       exit
    

 

BWD TOC FWD

Step 4 - Install the additional Python dependencies
for OpenERP-Server and OpenERP-Client

  • Download and install psycopg2

       cd ~/Installation
       
       curl -O "http://initd.org/pub/software/psycopg/psycopg2-2.0.14.tar.gz"
       tar --no-same-owner -xzf psycopg2-2.0.14.tar.gz
       cd psycopg2-2.0.14
       sudo /opt/local/bin/python2.6 setup.py install
       cd ..
    
  •  

  • Download and install PyChart

       curl -O "http://download.gna.org/pychart/PyChart-1.39.tar.gz"
       tar --no-same-owner -xzf PyChart-1.39.tar.gz
       cd PyChart-1.39
       sudo /opt/local/bin/python2.6 setup.py install
       cd ..
    
  •  

  • Download and install matplotlib

       curl -LO "http://ufpr.dl.sourceforge.net/project/matplotlib/matplotlib/matplotlib-1.0/matplotlib-1.0.0.tar.gz"
       tar --no-same-owner -xzf matplotlib-1.0.0.tar.gz
       cd matplotlib-1.0.0
    

    Edit setupext.py

       nano setupext.py
    

    The variable basedir for darwin should be set to:

          'darwin' : ['/opt/local', '/usr/local', '/usr'],
    

    Create setup.cfg from the template, and edit the default backend to be backend = GTKCairo

       cp setup.cfg.template setup.cfg
       nano setup.cfg
    

    Export the PKG_CONFIG_PATH and start the python installation in superuser mode

       sudo -s
       export PKG_CONFIG_PATH=/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/pkgconfig
       /opt/local/bin/python2.6 setup.py install
       exit
       cd ..
    
  •  

  • Add BRT to the time zones of pytz

       cd /opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages
       sudo cp pytz/zoneinfo/Brazil/East pytz/zoneinfo/BRT
    

    Edit pytz/__init__.py and add to the all_timezones[] array the code for BRT right before the entry CET.

       sudo nano pytz/__init__.py
    

    Enter <ctrl>-w and search for CET, in order to find the location where to add BRT. The list should look like:

       ...
       'Brazil/Acre',
       'Brazil/DeNoronha',
       'Brazil/East',
       'Brazil/West',
       'BRT',
       'CET',
       ...
    

    Exit nano with saving pytz/__init__.py, and remove the pre-compiled __init___.pyc file

       sudo rm pytz/__init__.pyc
       cd ~/Installation
    

 

BWD TOC FWD

Step 5 - Installation and first start of OpenERP Server & Client 5.0.14 from its Linux sources

  • Download and install of OpenERP-Server 5.0.14

       cd ~/Installation
       
       curl -LO "http://www.openerp.com/download/stable/source/openerp-server-5.0.14.tar.gz"
       tar --no-same-owner -xzf openerp-server-5.0.14.tar.gz
       sudo -s
       chown -R pgsql:pgsql openerp-server-5.0.14
       mv openerp-server-5.0.14 /usr/local/openerp-server-5.0.14
       ln -fhs /usr/local/openerp-server-5.0.14 /usr/local/openerp-server
       mkdir -p /usr/local/man/man1
       ln -fs /usr/local/openerp-server/man/openerp-server.1 /usr/local/man/man1/openerp-server.1
       mkdir -p /usr/local/man/man5
       ln -fs /usr/local/openerp-server/man/openerp_serverrc.5 /usr/local/man/man5/openerp_serverrc.5
    
  • First Start of the OpenERP-Server

       sudo -u pgsql /opt/local/bin/python2.6 /usr/local/openerp-server/bin/openerp-server.py -r pgsql -w pgsqlPASSWORD &
       exit
    
  • Please pay attention to the last parameter of the above command. The place holder "pgsqlPASSWORD" needs to be replaced by the real password of the pgsql user that has been defined when creating the PostgreSQL database cluster.

     

  • Download, install and first start of OpenERP-Client 5.0.14

       curl -LO "http://www.openerp.com/download/stable/source/openerp-client-5.0.14.tar.gz"
       tar --no-same-owner -xzf openerp-client-5.0.14.tar.gz
       /opt/local/bin/python2.6 openerp-client-5.0.14/bin/openerp-client.py
    

 

BWD TOC FWD

Step 6 - Refinements
- adjustments on the X11 defaults
- launch daemon startup scripts for the postgresql and the opernerp-server
- application wrapper for the openerp-client

  • In the Terminal adjust some useful defaults for the X11.app. Find out the glory details by typing

       man quartz-wm
       
       defaults write org.x.X11 sync_pasteboard -bool true
       defaults write org.x.X11 sync_pasteboard_to_clipboard -bool true
       defaults write org.x.X11 sync_pasteboard_to_primary -bool true
       defaults write org.x.X11 wm_auto_quit -bool true
       defaults write org.x.X11 wm_auto_quit_timeout -int 0
       defaults write org.x.X11 wm_click_through -bool true
       defaults write org.x.X11 wm_focus_on_new_window -bool true
       defaults write org.x.X11 wm_limit_size -bool true
    
  •  

  • Create/edit the file ~/.MacOSX/environment.plist for providing locale information to the OpenERP-Client

       mkdir -p ~/.MacOSX
       nano ~/.MacOSX/environment.plist
    

    add the following content:

       <?xml version="1.0" encoding="UTF-8"?>
       <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
       <plist version="1.0">
       <dict>
               <key>LANG</key>
               <string>de_DE.UTF-8</string>
               <key>LC_COLLATE</key>
               <string>de_DE.UTF-8</string>
               <key>LC_CTYPE</key>
               <string>de_DE.UTF-8</string>
               <key>LC_MESSAGES</key>
               <string>de_DE.UTF-8</string>
               <key>LC_MONETARY</key>
               <string>de_DE.UTF-8</string>
               <key>LC_NUMERIC</key>
               <string>de_DE.UTF-8</string>
               <key>LC_TIME</key>
               <string>de_DE.UTF-8</string>
               <key>LC_ALL</key>
               <string></string>
       </dict>
       </plist>
    

    Replace de_DE.UTF-8 with whatever your actual locale is, for example with pt_BR.UTF-8. If you are in doubt, then enter into the Terminal the command

       locale
    
  •  

  • The default double click interval of GTK of 250 ms is horribly short. In order to adjust the double-click interval, create a file for the GTK 2 settings in your home directory, ...

       nano ~/.gtkrc-2.0
    

    ... and copy the following line into the file:

    gtk-double-click-time = 500
    
  • If you like, you can change the default font here too - for example:

    gtk-font-name = "Verdana 9"
    

     

  • Create the file /Library/LaunchDaemons/org.postgresql.server.plist

       sudo nano /Library/LaunchDaemons/org.postgresql.server.plist
    

    Copy the following content into the file:

       <?xml version="1.0" encoding="UTF-8"?>
       <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
       <plist version="1.0">
       <dict>
               <key>Label</key>
               <string>org.postgresql.server</string>
               <key>OnDemand</key>
               <false/>
               <key>ProgramArguments</key>
               <array>
                       <string>/usr/local/pgsql/bin/postgres</string>
                       <string>-e</string>
                       <string>-D</string>
                       <string>/var/pgsql/data</string>
               </array>
               <key>UserName</key>
               <string>pgsql</string>
       </dict>
       </plist>
    
  •  

  • Create the file /Library/LaunchDaemons/com.openerp.server.plist

       sudo nano /Library/LaunchDaemons/com.openerp.server.plist
    

    Copy the following content into the file:

       <?xml version="1.0" encoding="UTF-8"?>
       <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
       <plist version="1.0">
       <dict>
               <key>Label</key>
               <string>com.openerp.server</string>
               <key>OnDemand</key>
               <false/>
               <key>ProgramArguments</key>
               <array>
                       <string>/opt/local/bin/python2.6</string>
                       <string>/usr/local/openerp-server/bin/openerp-server.py</string>
                       <string>-r</string>
                       <string>pgsql</string>
                       <string>-w</string>
                       <string>pgsqlPASSWORD</string>
               </array>
               <key>UserName</key>
               <string>pgsql</string>
       </dict>
       </plist>
    
  • Please pay attention to the last entry of ProgramArguments array. The place holder "pgsqlPASSWORD" needs to be replaced by the real password of the pgsql user that hase been defined when creating the PostgreSQL database cluster.

     

  • Restart the Mac!

    Verify with Console.app in the system.log, that the PostgreSQL Server and the OpenERP Server are running – if not then try in the Terminal:

       sudo -s
       cd /Library/LaunchDaemons
       launchctl load org.postgresql.postmaster.plist
       launchctl load com.openerp.server.plist
       exit
    

    Again, verify the system.log in Console.app for failures.

  •  

  • Create the Applcation wrapper for the openerp-client-5.0.14/bin/openerp-client.py. Select the Finder-Menu Go -> Go to Folder... and enter into the dialog box:

       ~/Installation/openerp-client-5.0.14/bin
    

    Switch the Folder to List-View

    Select the Finder-Menu Go -> Go to Folder... and enter into the dialog box:

       /Applications/MacPorts/Python 2.6
    

    Drag&drop the file openerp-client.py onto Build Applet application. This will create the Application wrapper for openerp-client.py with the name openerp-client.app. Note, that depending on your Finder settings, the extension .app might not be shown.

    Move the Application wrapper to the Desktop. Ctrl-click on it and from the Context Menu choose Show Package Contents. Locate the Folder Resource inside the Folder Contents and drag&drop all the files and folders inside of openerp-client-5.0.14/bin (not bin as such) into the Resources directory of the Application Wrapper.

    OpenERP-Client can now be started by double-clicking onto the openerp-client.app. The application wrapper is totally self-contained, and you can rename it and move it to anywhere you like.

     

  • Create a custom icon for the OpenERP application wrapper from your company logo with the developer tool Icon Composer, which you can find at:

       /Developer/Applications/Utilities/Icon Composer.app
    

    Locate and launch Icon Composer, and drag&drop your suitably sized company logo onto to main pane. You might want to let Icon Composer create the smaller sized icons for you. Save the icons as yourcompanyname.icns.

    create icns screen

    Ctrl-click on the OpenERP-Client application wrapper that has been created in the previous step. From the Context Menu choose Show Package Contents. Locate the Folder Resource inside the Folder Contents and drag&drop the file yourcompanyname.icns into the Resources directory of the Application Wrapper.

    Locate the file Info.plist in the Folder Contents, and double-click on it. This will open the deveolper tool Property List Editor and you need to enter the name of your icns file for the property Icon File.

    icon name screen

    Save Info.plist, quit Property List Editor, and close the OpenERP-Client application wrapper.

 

That's it!

 

BWD TOC FWD

Author

Dr. Rolf Jansen
Rua Reginaldo de Lima, 98 - Parque São Diogo
09732-550 São Bernardo do Campo - São Paulo
(Brazil)
rj(at)cyclaero.com
Cyclaero Blog

 

BWD TOC

Copyright Notice and Terms of Use

Provided you agree to be bound by the following terms of use, the author Dr. Rolf Jansen claims NO copyright for the information provided on this web page. This means it is Public Domain to all intelligent beings in the entire multiverse.

The terms of use are: Use the information provided on this web page at your own risk.
This means, Dr. Rolf Jansen cannot be held responsible for anything resulting from your use of said information.