Postgresql Install Errors on OSX

Update 09/17/2014: I’ve pretty much deprecated use of MacPorts and gone exclusively to Homebrew since this post. And I haven’t run into this problem since this post.

Update 12/28/2012: There’s an easier way to run PostgreSQL! Mattt Thompson has written Postgres app for Mac OSX that allows the database to run completely self-contained! Hassle-free! Last week I was trying out Sinatra and Padrino with PostgreSQL. But for the life of me, I couldn’t get PostgreSQL to run. At first I thought it was an issue with using MacPorts again. But after some googling, it seems like others who used Homebrew also had similar issues.

1
2
3
could not connect to database postgres: 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"?

There are a couple of ways to deal with this. One of them is to include the PostgreSQL path on OSX’s commandline lookup chain. In your .bash_profile (or .profile for others) file, you could add the path to the PostgreSQL binaries:

 export PATH=/opt/local/bin:/opt/local/sbin:/usr/local/mysql/bin:/opt/local/lib/postgresql91/bin:$PATH

Make sure the version number on PostgreSQL matches the version you are running.

References
* Installation of Postgresql on MacOS X using Macports
* Installing PostgreSQL 9.0 on Mac OS X 10.6.8 via MacPorts

Segmentation Fault with Rails 3.2.6 on OSX

I was trying to create a new project with Rails 3.2.x. But every time as it runs bundle install, I get the following error:

1
2
3
4
5
6
/Users/home_dir/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/net/http.rb:799: [BUG] Segmentation fault
ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-darwin11.4.0]
.
.
.
other crap

I tried gem uninstall and reinstalling Rails to no avail. It turns out that Ruby needs to find openssl but couldn’t find it at its preferred location. MacPorts handled all my 3rd party binary needs. But in this case, I wanted to use RVM to handle those packages for dependency reasons.

1
2
3
rvm pkg install iconv
rvm pkg install openssl
rvm reinstall 1.9.3 --with-openssl-dir=~/.rvm/usr --with-iconv-dir=~/.rvm/usr

And that solved the issue for me.

Update 02/22/2013: The lastest version of rvm 1.18.10 apparently will do all kinds of nice things in the background for you to solve the issue as well.

References:

Ruby on Rails Install with “Bad Interpreter” Errors

Today I decided to finally upgrade my Ruby on Rails setup at home. But upon running the rails -v command, I ran into this error:

bash: /opt/local/bin/rails: /opt/local/bin/ruby: bad interpreter: No such file or directory

Turns out for some reason there’s another (non-working) copy of rails in my /opt/local/bin/ directory. To fix the problem, I simply had to remove it (along with rake and other related executables out of there).

On a related note, I also tried upgrading rvm. But while trying to upgrade Ruby to the latest 1.9.3 with it using the rvm install 1.9.3, I kept getting this error:

curl: (7) couldn't connect to host

Finally, what worked was this:

curl -L get.rvm.io | bash -s stable --ruby

And to bind that to rails, similarly, do this:

curl -L get.rvm.io | bash -s stable --rails

That’s it.

Happy hacking.

References:
* Installing RVM
* RVM Repo

Object Oriented CSS

Finally got a chance to finish Nicole Sullivan’s (of Yahoo fame) presentation on OOCSS. On the surface, it’s kind of obvious that’s where things should be moving. But it’s surprising that I haven’t seen more about it on various UI/UX development sites I follow. The Compass framework is one that uses OOCSS.

Can’t wait to start implementing this strategy.

Quick Way to Generate Sprites with Corresponding CSS

Discovered Spritemapper over the weekend. You simply point to it a css file and let it lose. Spritemapper does the rest. It combines all the images being used in the css into one big image sprite, writes out an updated css with all the corresponding coordinates to the images, and voilà…

Mac OSX Lion Upgrade

After painstakingly backing my 27″ iMac, I upgraded to Mac OSX Lion. Not a whole lot changed total UX wise. But I do like what I see except for Launchpad.

Speaking of changes, one thing that broke was the driver for my old black & white Samsung ML-1710. I ended up having to install Splix-2.0.0 which worked decently… Well, it prints — and that’s really all I care about.

So yay.

I am Back?

Been thinking about giving my blogging a reboot for the past couple of years. Hopefully this time it’ll stick. But Facebook just makes it so much easier to “share” my thoughts. But one thing sucks about Facebook is I can’t easily search for my previous status updates (I’d have to go through 3rd party apps or websites to do that). And more importantly, there are often things I’d personally like to keep handy (like videos or photos I’d shared).

So going forward, I’ll try to be more proactive back on my own blog creating content that I will own. And I’ll probably find a plugin (or maybe write one) that’ll publish my blog entries (and maybe images?) to Facebook.

iPhone is the Reason I Wish I Knew C++

I knew not knowing the good old traditional c/c++ language would come back and haunt me one day.

The demand for iPhone developers exceeds the supply and I don’t see that changing anytime soon. The going rate for iPhone developers, at least the developers I know and trust, is $125/hour and up. I have some friends who are booked out at $200/hour for the next few months, although $125/hour seems to be the going rate in my network. At that rate, a full-time contract iPhone developer costs $5,000/week and it may take four to six weeks for an application to be developed. Sometimes it will take less and sometimes it will take more. Add to development the other costs – project management, design, QA, and marketing, to name a few. It’s not uncommon to spend $30,000 and up on an iPhone development project. iPhone applications are not cheap.

In this particular case, money is not necessarily the thing I am after, it’s really the excitement and possibility of working on a product I love and use everyday…

Tough Questions

A typical conversation with Bryan, my three-year-old….

Me: Bryan, Look. It’s raining.
Bryan: Why is it raining?
Me: Because there’s too much water in the cloud. And when there’s too much water in the cloud, water drops fall and becomes rain.
Bryan: Why is there too much water in the cloud?
Me: Because water evaporates into the air and eventually end up in the cloud.
Bryan: What is “evaporate”?
Me: ….
Bryan: Why is water falling from the sky? Is there a big hole in the sky?
Me: …. Um, no.
Bryan: Is the sky hard (as opposed to soft)?
.
.
.
I need to visit some science 101 sites for kids….

SVN Mania

Versions app

I’ve been meaning to set up Subversion for source control on my various projects. After having worked in an environment with tight source controls for almost half of a year, I’ve gotten used to the convenience and peace of mind of having a source control in place. So today I took the plunge and got svn to work with a SVN client, Versions, along with my favorite lightweight code editor Coda, on my MacBook Pro.

Life is good.