Shell Person Help me keep the shell people alive.

26Apr/140

Install watir-webdriver Ruby Gem on OSX Mavericks

To install watir-webdriver on Mavericks I had to install XCode Command Line Tools first, using the following command:

xcode-select --install

However, even after installing Command Line Tools I was getting the following errors when installing the Ruby gem:

5Oct/1210

Easy Install Error “unable to execute clang” on Mountain Lion

Recently I've been getting the error

error: Setup script exited with error: command 'clang' failed with exit status 1

when trying to install various Python libraries using Easy Install on OSX Mountain Lion (with Server.app installed). This happened recently trying to install psycopg2, but I've seen it before when trying to install lxml.

server:Desktop shellperson$ sudo easy_install psycopg2
Password:
Searching for psycopg2
Reading http://pypi.python.org/simple/psycopg2/
Reading http://initd.org/psycopg/
Reading http://initd.org/projects/psycopg2
Best match: psycopg2 2.4.5
Downloading http://initd.org/psycopg/tarballs/PSYCOPG-2-4/psycopg2-2.4.5.tar.gz
Processing psycopg2-2.4.5.tar.gz
Running psycopg2-2.4.5/setup.py -q bdist_egg --dist-dir /tmp/easy_install-TUzBu0/psycopg2-2.4.5/egg-dist-tmp-wjxjYJ
no previously-included directories found matching 'doc/src/_build'
unable to execute clang: No such file or directory
error: Setup script exited with error: command 'clang' failed with exit status 1

Fixed the problem by first installing Xcode from the App Store, then installing Command Line Tools from the Downloads section of Xcode's Preferences screen.

UPDATE: Now on Mavericks you can install Command Line Tools using the following command:

xcode-select --install

Credits:
http://stackoverflow.com/a/9403589

30Sep/120

New Location for org.postgresql.postgres.plist in Server.app 2.1.1

In Server.app 2.1.1 for OSX Mountain Lion, the PostgreSQL configuration file has been moved from

/System/Library/LaunchDaemons/org.postgresql.postgres.plist

to its new location at

/Library/Server/PostgreSQL/Config/org.postgresql.postgres.plist

You no longer need administrative privileges to edit it.

18Sep/120

Connect to OSX Server.app postgresql on Mountain Lion

Here are a few notes to remind myself how to connect to the default postgres instance used by OSX Server.app on Mountain Lion.

  1. Enable "Websites" in Server.app.
  2. Check if postgres is running
  3. sudo serveradmin fullstatus postgres
    
  4. If it's not, turn it on
  5. sudo serveradmin start postgres
    
  6. In order to connect with pgAdmin (and maybe through the terminal too), edit the file
    /System/Library/LaunchDaemons/org.postgresql.postgres.plist

    to replace

    <string>listen_addresses=</string>

    with

    <string>listen_addresses=127.0.0.1</string>
  7. UPDATE: The config file moved in the Server.app 2.1.1 update. It's now at:

    /Library/Server/PostgreSQL/Config/org.postgresql.postgres.plist
    
  8. Then restart postgres
  9. sudo serveradmin stop postgres
    sudo serveradmin start postgres
    
  10. Now, connecting with psql in terminal still causes this error (use template1 as the database name if you don't already have a database set up):
  11. server:~ shellperson$ psql template1
    psql: could not connect to server: Permission denied
    	Is the server running locally and accepting
    	connections on Unix domain socket "/var/pgsql_socket/.s.PGSQL.5432"?
    
  12. My preference to work around this is to create a user named "root" in the database, so I can just login with sudo. In order to do this, first login as the default user (_postgres). Use your own password.
  13. server:~ shellperson$ sudo -u _postgres psql template1
    Password:
    psql (9.1.4)
    Type "help" for help.
    
    template1=# create role root login;
    CREATE ROLE
    template1=# \q
    

    Once the user is created, you can login with "sudo psql databaseName".

    server:~ shellperson$ sudo psql template1
    

Articles referenced:
http://www.mactasia.co.uk/revisited-using-postgresql-in-lion-server
http://www.mactasia.co.uk/video-how-to-configure-postgres-in-lion-server-10-7-4
http://www.naveoss.com/site/282/tutorials/appletutorials/accessing-osx-lion-server-postgresql