-
Notifications
You must be signed in to change notification settings - Fork 74
Creating a standalone .app on the mac
David Stirling edited this page Apr 28, 2021
·
5 revisions
NOTICE: This page contains build instructions for the CellProfiler-Analyst 2.0 series. For the 3.0 series, run Pyinstaller with the `.spec` files found in the /distribution folder.
Note: CPA is currently not building for OSX Yosemite and higher. Please refer to our vagrant solution (https://github.com/CellProfiler/metabolism)
- Make sure you've updated from GitHub.
- cd to the CPA src directory
- Remove any old build/ or dist/ directories:
rm -rf build dist
- Make sure you have "universal binary" versions of numpy and scipy (i386 + ppc at least). See Building universal Numpy/Scipy on Mac. You'll also want to make sure that your cellprofiler extensions have been built as universal binaries.
- Run the py2app build script:
PYTHONPATH=../../CellProfiler python setup.py py2app
You'll need to set PYTHONPATH to point to your CellProfiler 2.0 directory. Supposedly, --use-pythonpath should be on the command line, but it seems to work without it
- Run dist/CPAnalyst.app and make sure it works
open dist/CPAnalyst.app
- Take special note of the revision # in the title bar (eg: in "CellProfiler Analyst 2.0 r8582" 8582 is the revision #). We'll need this later.
- Check that you have used the correct universal libraries by running
find CPAnalyst.app -name \*.o -o -name \*.so | xargs file
everything should look like this:
CPAnalyst.app//Contents/Resources/lib/python2.5/lib-dynload/zlib.so: Mach-O universal binary with 2 architectures CPAnalyst.app//Contents/Resources/lib/python2.5/lib-dynload/zlib.so (for architecture i386): Mach-O bundle i386 CPAnalyst.app//Contents/Resources/lib/python2.5/lib-dynload/zlib.so (for architecture ppc): Mach-O bundle ppc
not like this:
CPAnalyst.app//Contents/Resources/lib/python2.5/scipy/ndimage/_nd_image.so: Mach-O bundle i386
- Fix any libgcc_s problems. (These are caused by py2app, I believe)
find . -name \*.so| xargs -n 1 otool -L | grep gcc_s
Check for any lines that look like:
@executable_path/../Frameworks/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1.0.0)
If they exist, run this command:
find . -name \*.so | xargs -n 1 install_name_tool -change @executable_path/../Frameworks/libgcc_s.1.dylib /usr/lib/libgcc_s.1.dylib
- Open CPAnalyst/manual/cpa_manual.doc in Word
- Save it as a PDF in the same directory as the .doc
- This can be done by file>print and using the pdf option.
- Create a new folder on your desktop called "CPA_release", we'll put all the necessary files in this folder
- Copy the following files into CPA_release/
CPAnalyst/src/dist/CPAnalyst.app CPAnalyst/src/mysql_plugins/ (whole directory) CPAnalyst/manual/cpa_manual.pdf CPAnalyst/properties/example.properties CPAnalyst/Properties_README.txt CPAnalyst/LICENSE.txt
- Make sure double-clicking CPAnalyst.command launches the app
Run the command:
hdiutil create -imagekey zlib-level=9 -srcfolder CPAnalyst CPAnalyst_2.0_rXXX_mac.dmg
replacing XXX with the version number.