Tuesday, March 2, 2010

How to add ssh private key to Apple Keychain.


After all sorts of tries in figuring out how to login to remote server using ssh and do a svn update, I was still having problems with my keys on the remote server.

Rossi found this which saved me:


From: http://www.schmidp.com/2009/06/23/enable-ssh-agent-key-forwarding-on-snow-leopard/

You may need to add your passphrases to the Apple keychain. In the terminal, type:
ssh-add -K ~/.ssh/id_rsa
Or whatever the path to your private key is. Do this for each key. This will put the passphrase in the Apple keychain and you will not be prompted for passphrases. If you do not have a key in the default file (id_rsa or id_dsa), the Apple mechanisms do not seem to automatically prompt you for your passphrases.
That worked for me.
Best wishes,
Alan

Tuesday, January 12, 2010

Installing Zope 2.12.0 with buildout

I've tried a couple of times to install Zope 2 from various instructions I found online.  Each give me a unique set of problems.  I've installed a fresh version of Python 2.6 in previous post, and have used these instructions for installing Zope 2 using a buildout.

Here's my following/adaptions of instructions from http://docs.zope.org/zope2/zdgbook/GettingStarted.html

$ mkdir zopeproj1
$ cd zopeproj1/
$ touch buildout.cfg
$ wget -c http://svn.zope.org/repos/main/zc.buildout/trunk/bootstrap/bootstrap.py

--22:09:09--  http://svn.zope.org/repos/main/zc.buildout/trunk/bootstrap/bootstrap.py
           => `bootstrap.py'
Resolving svn.zope.org... 74.84.203.155
Connecting to svn.zope.org[74.84.203.155]:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 3,807 [application/x-httpd-cgi]

100%[===================================================================================================>] 3,807         --.--K/s            

22:09:09 (1.00 MB/s) - `bootstrap.py' saved [3807/3807]

$ ls
bootstrap.py buildout.cfg

$ ~/myprojects/opt/Python-2.6.4/bin/python2.6 bootstrap.py
Downloading http://pypi.python.org/packages/2.6/s/setuptools/setuptools-0.6c11-py2.6.egg
Creating directory '/Users/jbglenn/myprojects/zope2/zopeproj1/bin'.
Creating directory '/Users/jbglenn/myprojects/zope2/zopeproj1/parts'.
Creating directory '/Users/jbglenn/myprojects/zope2/zopeproj1/eggs'.
Creating directory '/Users/jbglenn/myprojects/zope2/zopeproj1/develop-eggs'.
Generated script '/Users/jbglenn/myprojects/zope2/zopeproj1/bin/buildout'.

$ mate buildout.cfg
made buildout look like this:
[buildout]
parts = zope2
        instance
extends = http://download.zope.org/Zope2/index/2.12.0/versions.cfg

[zope2]
recipe = zc.recipe.egg
eggs = Zope2
interpreter = zopepy

[instance]
recipe = plone.recipe.zope2instance
user = admin:admin
http-address = 8080
eggs = ${zope2:eggs}
$ ./bin/buildout 

Here are parts of the results of buildout (in case anyone is following along).  These show the errors/warnings I get.  It did finish buildout "successfully" though and works so far:
Got plone.recipe.zope2instance 4.0a2.
Getting distribution for 'Zope2>=2.12.1'.
src/AccessControl/cAccessControl.c:596: warning: initialization from incompatible pointer type
src/AccessControl/cAccessControl.c:598: warning: ‘intargfunc’ is deprecated
src/AccessControl/cAccessControl.c:598: warning: initialization from incompatible pointer type
src/AccessControl/cAccessControl.c:599: warning: ‘intargfunc’ is deprecated
src/AccessControl/cAccessControl.c:599: warning: initialization from incompatible pointer type
src/AccessControl/cAccessControl.c:600: warning: ‘intintargfunc’ is deprecated
src/AccessControl/cAccessControl.c:600: warning: initialization from incompatible pointer type
src/AccessControl/cAccessControl.c:601: warning: initialization from incompatible pointer type
src/AccessControl/cAccessControl.c:602: warning: initialization from incompatible pointer type
src/AccessControl/cAccessControl.c:606: warning: ‘intargfunc’ is deprecated
src/AccessControl/cAccessControl.c:606: warning: initialization from incompatible pointer type
src/AccessControl/cAccessControl.c:596: warning: initialization from incompatible pointer type
src/AccessControl/cAccessControl.c:598: warning: ‘intargfunc’ is deprecated
src/AccessControl/cAccessControl.c:598: warning: initialization from incompatible pointer type
src/AccessControl/cAccessControl.c:599: warning: ‘intargfunc’ is deprecated
src/AccessControl/cAccessControl.c:599: warning: initialization from incompatible pointer type
src/AccessControl/cAccessControl.c:600: warning: ‘intintargfunc’ is deprecated
src/AccessControl/cAccessControl.c:600: warning: initialization from incompatible pointer type
src/AccessControl/cAccessControl.c:601: warning: initialization from incompatible pointer type
src/AccessControl/cAccessControl.c:602: warning: initialization from incompatible pointer type
src/AccessControl/cAccessControl.c:606: warning: ‘intargfunc’ is deprecated
src/AccessControl/cAccessControl.c:606: warning: initialization from incompatible pointer type
src/AccessControl/cAccessControl.c:596: warning: initialization from incompatible pointer type
src/AccessControl/cAccessControl.c:598: warning: ‘intargfunc’ is deprecated
src/AccessControl/cAccessControl.c:598: warning: initialization from incompatible pointer type
src/AccessControl/cAccessControl.c:599: warning: ‘intargfunc’ is deprecated
src/AccessControl/cAccessControl.c:599: warning: initialization from incompatible pointer type
src/AccessControl/cAccessControl.c:600: warning: ‘intintargfunc’ is deprecated
src/AccessControl/cAccessControl.c:600: warning: initialization from incompatible pointer type
src/AccessControl/cAccessControl.c:601: warning: initialization from incompatible pointer type
src/AccessControl/cAccessControl.c:602: warning: initialization from incompatible pointer type
src/AccessControl/cAccessControl.c:606: warning: ‘intargfunc’ is deprecated
src/AccessControl/cAccessControl.c:606: warning: initialization from incompatible pointer type
src/DocumentTemplate/cDocumentTemplate.c:169: warning: initialization from incompatible pointer type
src/DocumentTemplate/cDocumentTemplate.c:600: warning: initialization from incompatible pointer type
src/DocumentTemplate/cDocumentTemplate.c:169: warning: initialization from incompatible pointer type
src/DocumentTemplate/cDocumentTemplate.c:600: warning: initialization from incompatible pointer type
src/DocumentTemplate/cDocumentTemplate.c:169: warning: initialization from incompatible pointer type
src/DocumentTemplate/cDocumentTemplate.c:600: warning: initialization from incompatible pointer type
src/MultiMapping/_MultiMapping.c:159: warning: initialization from incompatible pointer type
src/MultiMapping/_MultiMapping.c:159: warning: initialization from incompatible pointer type
src/MultiMapping/_MultiMapping.c:159: warning: initialization from incompatible pointer type
src/Record/_Record.c: In function ‘Record___setstate__’:
src/Record/_Record.c:81: warning: passing argument 2 of ‘PyDict_Next’ from incompatible pointer type
src/Record/_Record.c: At top level:
src/Record/_Record.c:338: warning: initialization from incompatible pointer type
src/Record/_Record.c:340: warning: ‘intargfunc’ is deprecated
src/Record/_Record.c:340: warning: initialization from incompatible pointer type
src/Record/_Record.c:341: warning: ‘intargfunc’ is deprecated
src/Record/_Record.c:341: warning: initialization from incompatible pointer type
src/Record/_Record.c:342: warning: ‘intintargfunc’ is deprecated
src/Record/_Record.c:342: warning: initialization from incompatible pointer type
src/Record/_Record.c:343: warning: initialization from incompatible pointer type
src/Record/_Record.c:344: warning: initialization from incompatible pointer type
src/Record/_Record.c:425: warning: initialization from incompatible pointer type
src/Record/_Record.c: In function ‘Record___setstate__’:
src/Record/_Record.c:81: warning: passing argument 2 of ‘PyDict_Next’ from incompatible pointer type
src/Record/_Record.c: At top level:
src/Record/_Record.c:338: warning: initialization from incompatible pointer type
src/Record/_Record.c:340: warning: ‘intargfunc’ is deprecated
src/Record/_Record.c:340: warning: initialization from incompatible pointer type
src/Record/_Record.c:341: warning: ‘intargfunc’ is deprecated
src/Record/_Record.c:341: warning: initialization from incompatible pointer type
src/Record/_Record.c:342: warning: ‘intintargfunc’ is deprecated
src/Record/_Record.c:342: warning: initialization from incompatible pointer type
src/Record/_Record.c:343: warning: initialization from incompatible pointer type
src/Record/_Record.c:344: warning: initialization from incompatible pointer type
src/Record/_Record.c:425: warning: initialization from incompatible pointer type
src/Record/_Record.c: In function ‘Record___setstate__’:
src/Record/_Record.c:81: warning: passing argument 2 of ‘PyDict_Next’ from incompatible pointer type
src/Record/_Record.c: At top level:
src/Record/_Record.c:338: warning: initialization from incompatible pointer type
src/Record/_Record.c:340: warning: ‘intargfunc’ is deprecated
src/Record/_Record.c:340: warning: initialization from incompatible pointer type
src/Record/_Record.c:341: warning: ‘intargfunc’ is deprecated
src/Record/_Record.c:341: warning: initialization from incompatible pointer type
src/Record/_Record.c:342: warning: ‘intintargfunc’ is deprecated
src/Record/_Record.c:342: warning: initialization from incompatible pointer type
src/Record/_Record.c:343: warning: initialization from incompatible pointer type
src/Record/_Record.c:344: warning: initialization from incompatible pointer type
src/Record/_Record.c:425: warning: initialization from incompatible pointer type
Got Zope2 2.12.3.
Getting distribution for 'zope.app.schema==3.5.0'.

-------
Getting distribution for 'five.formlib'.
Got five.formlib 1.0.2.
Getting distribution for 'docutils==0.5'.
"optparse" module already present; ignoring extras/optparse.py.
"textwrap" module already present; ignoring extras/textwrap.py.
zip_safe flag not set; analyzing archive contents...
docutils.parsers.rst.directives.misc: module references __file__
docutils.writers.html4css1.__init__: module references __file__
docutils.writers.newlatex2e.__init__: module references __file__
docutils.writers.pep_html.__init__: module references __file__
docutils.writers.s5_html.__init__: module references __file__
Got docutils 0.5.
Getting distribution for 'ZODB3==3.9.0'.
-------
Got zope.copypastemove 3.5.2.
Getting distribution for 'zope.minmax==1.1.0'.
Got zope.minmax 1.1.0.
Installing zope2.
Generated script '/Users/jbglenn/myprojects/zope2/zopeproj1/bin/runzope'.
Generated script '/Users/jbglenn/myprojects/zope2/zopeproj1/bin/zopectl'.
Generated script '/Users/jbglenn/myprojects/zope2/zopeproj1/bin/zpasswd'.
Generated script '/Users/jbglenn/myprojects/zope2/zopeproj1/bin/mkzeoinstance'.
Generated script '/Users/jbglenn/myprojects/zope2/zopeproj1/bin/mkzopeinstance'.
Generated interpreter '/Users/jbglenn/myprojects/zope2/zopeproj1/bin/zopepy'.
Installing instance.
Traceback (most recent call last):
  File "", line 1, in
ImportError: No module named Zope2
Generated script '/Users/jbglenn/myprojects/zope2/zopeproj1/bin/instance'.

---------------------------------------
$ ./bin/instance fg
/Users/jbglenn/myprojects/zope2/zopeproj1/parts/instance/bin/runzope -X debug-mode=on
2010-01-12 22:22:34 INFO ZServer HTTP server started at Tue Jan 12 22:22:34 2010
Hostname: 0.0.0.0
Port: 8080
2010-01-12 22:22:37 INFO Zope Ready to handle requests


Python 2.6 on Mac OSX 10.6

I had a lot of problems before installing python for the 64 bit Mac OS X that would work with my projects.

I have been playing around with it.  It's important to notice there is a Mac folder under the source directory when you are building Python.  It has a README which was helpful.

Here's some documentation for me, because I know I won't remember which ones worked for me:
$ tar xfz Python-2.6.4.tgz

$ cd Python-2.6.4


$ ./configure --prefix=/Users/jbglenn/myprojects/opt/Python-2.6.4 --enable-universalsdk=/Developer/SDKs/MacOSX10.6.sdk --with-universal-archs=3-way

$make 

$make install 



$ bin/python
Python 2.6.4 (r264:75706, Jan 12 2010, 21:58:20)
[GCC 4.2.1 (Apple Inc. build 5646) (dot 1)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.maxint
9223372036854775807
>>> quit()

I'll let you know if this bombs on any of my projects.

Tuesday, January 5, 2010

Installing Python 2.4 with buildout on Snow Leopard

So, a different way to install Python 2.4 on Snow Leopard without downloading the src directly and building it, is to use buildout.

Help was provided on Reinout van Rees's blog here: http://reinout.vanrees.org/weblog/2009/09/28/python-snowleopard-rescue.html

I created a folder under my ~/projects folder called python_buildout
$ cd ~/projects
$ mkdir python_buildout

I checked out the buildout:
$ svn co http://svn.plone.org/svn/collective/buildout/python/ .

Ran the bootstrap.py:
$ /usr/bin/python bootstrap.py

This was important to run from /usr/bin/python and not the MacPorts version if you installed that.  I ran with default python which was my MacPorts version and it failed.

Ran the buildout:
$ bin/buildout

References:
http://svn.plone.org/svn/collective/buildout/python/src/docs/INSTALL.txt

Installing MacPorts Python 2.4 on Snow Leopard

MacPorts lets you install packages on your Mac.

To Install MacPorts, go to Download page and click the dmg for the Snow Leopard
http://distfiles.macports.org/MacPorts/MacPorts-1.8.2-10.6-SnowLeopard.dmg

Run it and it will install.
I rebooted after so my system would find it.

Then you can run:
$ sudo port install python24

It will install python 2.4 for you.

Wednesday, December 30, 2009

Jim B's Blog's 1 Year aniversary

Well,
This blog has been up for 1 year.  I just opened the blog up to the Internet about a month ago, so I don't have a lot of comments from anyone.

I use this for technical stuff.  It's designed more for me to keep notes for myself on tech stuff.
Hopefully, this coming year I might write more articles than just notes for myself on how to install stuff.

Either way,
Enjoy,
Let me know if you like something.

-jbg

Tuesday, December 29, 2009

Getting a Mac Ready for Development

I'm a programmer, developer, or whatever you want to call me.
I have an Mac with OS X, Snow Leopard that I wanted to setup for development.  Here are the first few steps in order to get started.

1.  Rename your computer to something more manageable.
Instead of Jim's MacBook or Jessica's iMac, how about naming it to a better name.  This way you won't have to go to http://ip address or http://localhost when working with webpages locally, instead you can go to http://hostname.  Try a theme, seasame street, famous cities, presidents, or other theme.

For example, what about chicago.  Then you can go to http://chicago when you setup your webserver.

2. Turn on webhosting
Go to system settings-> Sharing -> Turn on Websharing

3. Turn on remote access for ssh
Go to system settings-> Sharing -> Remote Login
Change settings so only you can remote in.

4. Install and setup IM clients, and IRC clients.
a.) For me, I use iChat that is built in, so I just added my accounts under iChat->Preferences->Accounts
b.) I also use skype.  Download skype and sign in with your account.
c.) For IRC, I use Colloquy, I sign into freenode with url:  irc.freenode.net.  I also play around with the Preferences under Colloquy menu.

5. Install XCode with Unix support.
This lets you run "build" commands for Unix tools as well as use XCode if you want to later.
It's on the System CD that came with your Mac.

6. Install wget
Follow the instructions here: http://asitis.org/installing-wget-for-mac-os-x

7.  Backup with Time Machine
Don't forget to backup.  You can backup with Time Machine to Time Capsule or USB Drive. I use Time Capsule.  I prefer to backup as soon as I can, usually first night -> second day when there is the least amount of data on my drives.  That way first backup will be done.   You can also run the first backup with ethernet for added speed, something I never have patience to hookup. :)


8. install your svn keys.
For me, I already have svn keys on another machine that I will need to get into resources like ssh for servers and svn accounts.  So, I copy the .svn folder from my home folder onto new machine.

9. make shortcut for terminal on your dock.
It's under Applications -> Utilities.  I use it enough.  This is a great time to start customizing your dock for your own liking.

10. Other non-developer specific setups:
E-mail, Calendar, Contacts, I-Tunes
This is when I spend a little time to copy over and setup many of my "non-developer" apps.  That way they are ready to go.

11. Installing Python 2.6.4
I've written other blog entries about custom installing Python.  For my Mac, I installed as 32 bit, which meant to --enabled-shared flag.  I install under /opt/Python-2.6.4 which means I needed to make the /opt directory.  Don't forget to create you .profile and setup your path to use the right Python.
References:
Python 2.6.4 compressed source tarball
http://www.python.org/download/

12. TextMate
TextMate is the editor of choice for Mac.  I discovered my old license could be used for my new Mac.  Read up on what your license is for.  Save some money. :)
Reference:
TextMate — The Missing Editor for Mac OS X

13. setting up a shortcut for "safari" command line
I like having a safari command.  I do a lot of website testing and it's convient to be able to type into Terminal to open a path with a specific webbrowser.
Reference:
Creating a safari command

14. setup your hostname in /etc/hosts
The name you setup in step 1.  It's nice to be able to go straight to it, instead of always typing http://localhost.  Edit your /etc/hosts and add your hostname after localhost for 127.0.0.1.