Skip to content

Release MacOS

Tom Mitchell edited this page Mar 2, 2017 · 7 revisions

Instructions for Creating an Omni MacOS Application

Get Omni Working on MacOS with a Ready Environment

Go here: Cranking Out the MacOS Omni Release - if you have already done the steps stated below before (as on the separate GCF release laptop). It is a cheat sheet for remembering the last few steps of the process.

Get Omni Working on MacOS

Most dependencies mentioned here are cached: http://www.gpolab.bbn.com/internal/projects/gcf/dependencies/

Install Python

Install the 2.7.6 Version of Python from http://python.org/download/.

Reset the PATH so that python is found in /usr/local/bin

The above will install python at /usr/local/bin but the python that comes with Mac OS is at /usr/bin which takes precedence in the path, so modify your ~/.profile file and add this line:

      export PATH=/usr/local/bin:$PATH

and then run:

source ~/.profile
  • Type which python to ensure that you are using the right one.
  • DO NOT use brew to install Python. The brew Python distribution will not work.

Install XCode

  • To determine whether XCode is installed: type "xcode-select -p or xcode-select --print-path" and this should return a path if it is already installed.
  • To install Xcode for Mac OSX 10.8 or later:
    • The App Center requires an apple login for downloading free software, including Xcode tools. Xcode tools includes, git, svn, gcc and cvs clients.
    • Make sure to click on the Xcode App and ensure that it is installed.

Install Homebrew and pip using homebrew

    ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"

Follow any instructions after installation, such as typing

    brew doctor 

Install pip

    sudo easy_install pip

Install GCF dependencies

  • sudo chmod 777 /Library/Python/2.7/site-packages
  • brew install swig
  • pip install M2Crypto==0.22.3
    • Note: there can be quite a few warnings during this step, simply ignore them.
  • brew install libxmlsec1
  • pip install python-dateutil==1.5
  • sudo pip install pyopenssl==0.14

If you want to test if your python can access the libraries you want, just start python in interactive mode (python -i) and try to import the module (e.g. import M2Crypto). These instructions for installing dependencies are also at https://github.com/GENI-NSF/geni-tools/wiki/QuickStart#Usinghomebrew.

  • The instruction to modify the first line of omni.py, omni-configure.py, etc. to be #!/usr/local/bin/python is no longer needed as these files start with a #!/usr/bin/env python and so pick up the right python.

Set PATH and PYTHONPATH environment variables

In order to be able to run omni.py, gcf-am.py and any of the scripts (e.g. readyToLogin.py) you will need to modify the PATH and the PYTHONPATH environment variables.

Also it is useful to add aliases to the commonly used commands so that you don't have to specify the .py in your commands; e.g. you can configure omni by just running omni-configure instead of omni-configure.py

The aliases are added as part of the package install by gcf/mac_install/addAliases.command. Otherwise, do them by hand as below:

It is recommended that you make these modifications in a configuration file so that they are set every time you login to your host. The name of the configuration file is dependent on the shell you are running.

In order to figure out which shell you are using run:

 ps -p $$

If you are using a bash shell, copy and paste these lines to the end of your .bashrc file. This file is located in your home directory. If the file does not exist, you can create it. If you are using a different shell, then modify these lines appropriately and add them to the configuration file of your shell. Make sure to replace <PATH-TO-GCF-DIR> with the actual path to your gcf directory. For example if you have installed gcf under /usr/local/bin/ then <PATH-TO-GCF-DIR> is /usr/local/bin/gcf.

# set PATH so it includes geni software if it exists
if [ -d "<PATH-TO-GCF-DIR>/src" ] ; then
    PATH="<PATH-TO-GCF-DIR>/src:<PATH-TO-GCF-DIR>/examples:$PATH"
    export PYTHONPATH="<PATH-TO-GCF-DIR>/src:$PYTHONPATH" 
fi

alias clear-passphrases='/Applications/omniTools-2.5/clear-passphrases.app/Contents/MacOS/clear-passphrases'
alias omni='/Applications/omniTools-2.5/omni.app/Contents/MacOS/omni'
alias omni-configure='/Applications/omniTools-2.5/omni-configure.app/Contents/MacOS/omni-configure'
alias readyToLogin='/Applications/omniTools-2.5/readyToLogin.app/Contents/MacOS/readyToLogin'
alias stitcher='/Applications/omniTools-2.5/stitcher.app/Contents/MacOS/stitcher'
alias addMemberToSliceandSlivers ='/Applications/omniTools-2.5/addMemberToSliceandSlivers.app/Contents/MacOS/addMembersToSliceandSlivers'
alias remote-execute ='/Applications/omniTools-2.5/remote-execute.app/Contents/MacOS/remote-execute'

Examples:

PYTHONPATH=/Users/geni/gcf/src:/usr/local/opt/libxml2/lib/python2.7/site-packages:/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python

PATH=/usr/local/bin:/Users/geni/gcf/src:/Users/geni/gcf/examples:/Library/Frameworks/Python.framework/Versions/2.7/bin:/usr/bin:/bin:/usr/sbin:/sbin

For the changes to take effect in your current terminal run:

   source <configuration_file>

These instructions are copied from https://github.com/GENI-NSF/geni-tools/wiki/QuickStart#a2.AddGCFtoyourpath

Get the latest GCF release and configure omni

  1. Unpack or move gcf-rel# to the gcf directory or whatever matches your PATH variable setting above.

    git clone https://github.com/GENI-NSF/geni-tools.git  and then git checkout the correct release branch
    
  2. Pull down user omni-bundle.zip from the portal to help with configuring for omni.

  • As of 2/11/2014 - do not pull the omni-bundle.zip down using Safari. Use any other browser.
  1. Run omni-configure.py. If that doesn't work look here: https://github.com/GENI-NSF/geni-tools/wiki/QuickStart
  2. Do basic tests
  • Run omni.py -h to see if it is working.
  • Talk to the Clearing House by typing omni.py getusercred -o.
  • Talk to any AM. Try omni.py -a ig-gpo getversion

Create Mac OS apps

We need to convert these python scripts to Mac apps. Instructions are below...

  1. clear-passphrases.py
  2. omni.py
  3. omni-configure.py
  4. stitcher.py
  5. readyToLogin.py
  6. addMemberToSliceAndSlivers.py
  7. remote-execute.py

Pre-work for packaging the binaries

  1. Pick a release number. In these instructions, version is 2.5 and rel# should be substituted as 2.5. And rc# is release candidate number, with number monotonically increasing.
  2. Make a directory omniTools that will be packaged into a .dmg for distribution. From Finder, this is the directory to pull into iDMG.
  3. Make another directory omniTools-2.5 inside the directory created above. Resulting hierarchy looks like ~/omniTools/omniTools-2.5.
  4. Follow instructions from Apple as to how to change the icon of a folder to change the icon of the inner omniTools-2.5 folder: Change Folder Icon.
  • In Finder, navigate to and open (in preview) the !OmniGraphic.png file in gcf/mac_install for the folder icon (the mac_install folder is also in ~ on the release laptop)

  • Edit->Select All, then Copy

  • In Finder, navigate to the new omniTools-2.5 directory

  • Command-I (Or right click then Get Info)

  • Click the folder icon in the top left

  • Paste

Note: The only confusion here was that the OmniGraphic.png needed to be opened in preview. Do a select all on the image and then do a copy to the clipboard. The image can then be copied successfully over the folder icon. Also note that a release tarball will not have this image - get it from git.

Making apps out of the GCF Python scripts

There is a makeMacdmg.sh in the gcf/src/mac_install directory that does all the steps here along with copying the supporting files.

With the supporting files, check that background.png is in your git checkout (otherwise copy it in).

All the steps enumerated below are captured in the makeMacdmg.sh. And as long as the pre-work instructions for the directories has been done and that the initial variables have been edited in the makeMacdmg.sh to point to the correct place, running the makeMacdmg.sh should be all that is needed to create the applications prior to creating the mac .dmg file.

  1. Download and install py2app using instructions at http://pythonhosted.org/py2app/install.html. Use the "Installing with easy_install" method, "easy_install -U py2app". I could not get the pip installed version to work.
  1. cd to the directory where omni.py (e.g. .../gcf-2.4.1/src) is installed.
  2. py2applet --make-setup omni.py
  3. python setup.py py2app --no-chdir
  4. You will see a directory called dist in your current directory. Inside this directory you will see a omni.app. Move omni.app to the directory .../omniTools/omniTools you created in the pre-work for packaging.
  5. Delete the dist and build folders: rm -r build dist setup.py
  6. Repeat the above 4 steps for each of the scripts you want packaged including at least the 5 already listed. E.g.:
  7. py2applet --make-setup omni-configure.py
  8. python setup.py py2app --no-chdir
  9. You will see a directory called dist in your current directory. Inside this directory you will see a omni-configure.app. Move omni.app to the directory .../omniTools/omniTools you created in the pre-work for packaging.
  10. Delete the dist and build folders: rm -r build dist
  11. Go to the examples directory (e.g. .../gcf-2.4.1/examples) and build executables out of the scripts there (e.g. readyToLogin.py) following the above instructions.

Add Supporting Files

Add the LICENSE.txt file

  1. Copy the gcf/windows_install/LICENSE.txt file to ./omniTools/omniTools and to ./omniTools.

Add the INSTALL.txt file

  1. Copy the gcf/mac_install/INSTALL.txt file to ./omniTools.

Add the addAliases.command file

  1. Copy the gcf/mac_install/addAliases.command file to ./omniTools/omniTools. Check that it is executable.

Add the iDMG Background png file

  1. Copy the gcf/mac_install/background.png file to ./omniTools/omniTools and use this file in iDMG for the background image.

Package the MacOS Apps as a .dmg

For reference, see: http://codevarium.gameka.com.br/how-to-create-your-own-beautiful-dmg-files/

Notes for clarification:

  1. Create the link in the ./omniTools-2.5 directory, the higher level. This step may have already been done by the makeMacdmg.sh. ln -s /Applications Applications
  2. Now, open iDMG and go to menu Window → Inspector. In the first tab, you can name the "Volume name" with an app name, omniTools-2.5. It is important to name it as the final intended name, so do not include the rc# string in the Volume name in iDMG. This saves work when a release candidate is accepted as final and all that needs to be done is to rename the .dmg. In "Format", choose "Read and Write". Close the inspector. Now, drag the "~/omniTools" folder to iDMG. It will create a omniTools-version.dmg file.
  3. Open the omniTools-2.5.dmg to mount it, and open the mounted device on Finder. Press Cmd+J and it will show a window where you can click the Picture Radio button in the Background pane. Drag the background.png to this window, where it says “Drag image here”.
  4. Close this window. Go back to Finder. Reorganize your file positions as you wish. Now, we need to hide the toolbar of the window. To do that, go to Finder menu View → Hide Toolbar. Now, close your Finder and find your mounted device at the desktop. Right click it and choose “Eject”.
  5. The omniTools-2.5.dmg must be converted to be read-only. In the directory containing omniTools-2.5.dmg, type hdiutil convert -format UDZO -o omniTools-2.5.dmg omniTools-2.5-mac-rc#.dmg
  6. omniTools-2.5-mac-rc#.dmg is what should be tested for tool setup. Omni configuration needs to be followed after installation; instructions are here: https://github.com/GENI-NSF/geni-tools/wiki/Omni-Configuration-Automatically

Notes About Getting All This to Work

There was an attempt to get the versions of dependencies to be similar on MAC and Windows.
I had trouble getting py2applet to work because altgraph was version 0.10 and needed upgrading.

Adding the pip version information of packages installed.


> pip list

altgraph (0.11)
bdist-mpkg (0.4.4)
bonjour-py (0.3)
cffi (0.8.2)
cryptography (0.2.2)
libxml2-python (2.9.1)
M2Crypto (0.22.3)
macholib (1.5)
matplotlib (1.1.1)
modulegraph (0.11)
numpy (1.6.2)
pip (1.5.4)
py2app (0.8)
pycparser (2.10)
pyobjc-core (2.3.2a0)
pyobjc-framework-AddressBook (2.3.2a0)
pyobjc-framework-AppleScriptKit (2.3.2a0)
pyobjc-framework-AppleScriptObjC (2.3.2a0)
pyobjc-framework-Automator (2.3.2a0)
pyobjc-framework-CFNetwork (2.3.2a0)
pyobjc-framework-Cocoa (2.3.2a0)
pyobjc-framework-Collaboration (2.3.2a0)
pyobjc-framework-CoreData (2.3.2a0)
pyobjc-framework-CoreLocation (2.3.2a0)
pyobjc-framework-CoreText (2.3.2a0)
pyobjc-framework-DictionaryServices (2.3.2a0)
pyobjc-framework-ExceptionHandling (2.3.2a0)
pyobjc-framework-FSEvents (2.3.2a0)
pyobjc-framework-InputMethodKit (2.3.2a0)
pyobjc-framework-InstallerPlugins (2.3.2a0)
pyobjc-framework-InstantMessage (2.3.2a0)
pyobjc-framework-InterfaceBuilderKit (2.3.2a0)
pyobjc-framework-LatentSemanticMapping (2.3.2a0)
pyobjc-framework-LaunchServices (2.3.2a0)
pyobjc-framework-Message (2.3.2a0)
pyobjc-framework-OpenDirectory (2.3.2a0)
pyobjc-framework-PreferencePanes (2.3.2a0)
pyobjc-framework-PubSub (2.3.2a0)
pyobjc-framework-QTKit (2.3.2a0)
pyobjc-framework-Quartz (2.3.2a0)
pyobjc-framework-ScreenSaver (2.3.2a0)
pyobjc-framework-ScriptingBridge (2.3.2a0)
pyobjc-framework-SearchKit (2.3.2a0)
pyobjc-framework-ServiceManagement (2.3.2a0)
pyobjc-framework-SyncServices (2.3.2a0)
pyobjc-framework-SystemConfiguration (2.3.2a0)
pyobjc-framework-WebKit (2.3.2a0)
pyobjc-framework-XgridFoundation (2.3.2a0)
pyOpenSSL (0.14)
PyRSS2Gen (1.0.0)
python-dateutil (1.5)
pytz (2012d)
scipy (0.11.0)
Warning: cannot find svn location for setuptools==0.6c12dev-r88846
setuptools (0.6c12dev-r88846)
six (1.6.1)
Twisted (12.2.0)
wsgiref (0.1.2)
xattr (0.6.4)
zope.interface (3.8.0)

And then the brew state:

ls -1 /Library/Caches/Homebrew/*
/Library/Caches/Homebrew/gmp-5.1.3.mavericks.bottle.2.tar.gz
/Library/Caches/Homebrew/gnutls-3.2.12.1.mavericks.bottle.tar.gz
/Library/Caches/Homebrew/libgcrypt-1.6.1.mavericks.bottle.tar.gz
/Library/Caches/Homebrew/libgpg-error-1.12.mavericks.bottle.tar.gz
/Library/Caches/Homebrew/libtasn1-3.4.mavericks.bottle.tar.gz
/Library/Caches/Homebrew/libxml2-2.9.1.mavericks.bottle.tar.gz
/Library/Caches/Homebrew/libxmlsec1-1.2.19.tar.gz
/Library/Caches/Homebrew/nettle-2.7.1.mavericks.bottle.tar.gz
/Library/Caches/Homebrew/pcre-8.34.mavericks.bottle.tar.gz
/Library/Caches/Homebrew/pkg-config-0.28.mavericks.bottle.2.tar.gz
/Library/Caches/Homebrew/swig-2.0.12.mavericks.bottle.tar.gz

/Library/Caches/Homebrew/Formula:
gmp.brewing
gnutls.brewing
libgcrypt.brewing
libgpg-error.brewing
libtasn1.brewing
libxml2.brewing
libxmlsec1.brewing
nettle.brewing
pcre.brewing
pkg-config.brewing
swig.brewing
xz.brewing

And iDMG used was version 2.70

Clone this wiki locally