Showing posts with label OS X. Show all posts
Showing posts with label OS X. Show all posts

November 15, 2008

mod_rails (Passenger) setup issues with Apache2 on OS X

mod_rails not finding Apache2 APR



When installing mod_rails with a custom Apache2 setup, you may get the following while running sudo passenger-install-apache2-module:


Compiling and installing Apache 2 module...
cd /usr/local/lib/ruby/gems/1.8/gems/passenger-2.0.3
rake clean apache2
(in /usr/local/lib/ruby/gems/1.8/gems/passenger-2.0.3)
rake aborted!
Could not find Apache Portable Runtime (APR).
/usr/local/lib/ruby/gems/1.8/gems/passenger-2.0.3/rakefile:37
(See full trace by running task with --trace)



The main reason for this is that mod_rails cannot find apr-1-config which should have been installed within (as per my system) /usr/local/apache2/bin. In order to solve the problem, you just need to add the Apache2 custom install bin directory to your user path (as per my system):


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


That should do it.

mod_rails and "MACOSX_DEPLOYMENT_TARGET environment variable"


The error you are most likely to get would be close to the following:


g++ -flat_namespace -bundle -undefined dynamic_lookup Utils.o Bucket.o Logging.o System.o Configuration.o Hooks.o mod_passenger.o -fPIC -o mod_passenger.so -lstdc++ -lpthread ../boost/src/libboost_thread.a -L/usr/local/apache2/lib -lapr-1
/usr/bin/ld: flag: -undefined dynamic_lookup can't be used with MACOSX_DEPLOYMENT_TARGET environment variable set to: 10.1
collect2: ld returned 1 exit status
rake aborted!
Command failed with status (1): [g++ -flat_namespace -bundle -undefined dyn...]
/usr/local/lib/ruby/gems/1.8/gems/passenger-2.0.3/rakefile:142
(See full trace by running task with --trace)


In this case, you will have to add the following to your environment variables


export MACOSX_DEPLOYMENT_TARGET=10.4

October 4, 2007

Ruby on Rails with Aquamacs

A friend of mine recently suggested that I look into Aquamacs. According to the website, Aquamacs is an Aqua-native build of the powerful Emacs text editor.

So, I went ahead and downloaded it. First thing I noticed is that it supported stuff for Ruby development right out of the box as the original Emacs. The only problems is, it's got a hard time working with regular indentations, with tabs and so on. I spent a few hours investigating and picking up hints from many places/sources I've put together a LISP script that makes using Aquamacs really nice for Ruby on Rails development.



; stuff for ruby on rails development
(add-to-list 'load-path
"~/Library/Preferences/Aquamacs Emacs/ruby")
(require 'ruby-mode)

; loads ruby mode when a .rb file is opened.
(setq auto-mode-alist
(cons '(".rb$" . ruby-mode) auto-mode-alist))

(setq auto-mode-alist
(cons '(".rhtml$" . html-mode) auto-mode-alist))

; this allows us to have constant indentation as
; we progress in the code from line to line.
(defun create-newline-and-indent()
(local-set-key [return] 'newline-and-indent))

(add-hook 'ruby-mode-hook 'create-newline-and-indent)


; enables ruby electric for easier editing of
; rb and rhtml files
(add-hook 'ruby-mode-hook
(lambda()
(add-hook 'local-write-file-hooks
'(lambda()
(save-excursion
(untabify (point-min) (point-max))
(delete-trailing-whitespace)
)))

; forces ruby-mode to use tabs for indentation with
; an indent level of 4
(setq indent-tabs-mode 1)
(setq ruby-indent-level 4)

; allows the [tab] key to work with width 4
(define-key ruby-mode-map "\t" 'self-insert-command)
(set (make-local-variable 'tab-width) 4)

(define-key ruby-mode-map "C-m" 'newline-and-indent)

; setting up ruby-electric
(require 'ruby-electric)
(ruby-electric-mode t)
))


The script can just be copied and pasted in your "Preferences.el" file which is used instead of the usual ".emacs.el". The Preferences.el file can be found in "~/Library/Preferences/Aquamacs Emacs".

Hope this saves a few hours for some people out there.

Cheers!

July 18, 2007

Ruby on Rails updates

I just finished updating the Ruby on Rails installation on my laptop.

I am now running the following:

Ruby 1.8.6
gem 0.9.4
Rails 1.2.3

It is interesting to see that I am already dealing with a few deprecations here and there.
It obviously is nothing major but I am currently going over my code to make sure that all
deprecations are resolved.

I think that I should have kept up-to-date a bit more regularly. In fact, I went from Ruby 1.8.4 to Ruby 1.8.6. This shows how long it had been since I updated.

Alright, just to remind all RoR developers out there to make sure things are up-to-date.

Cheers!

June 22, 2007

Tweaking Safari with Debug Menu

Ever wished you could tweak Safari the same way it's possible to tweak Firefox and other browsers currently on the market? Well, my exploration of Safari continued. I discovered that Safari has a debug menu that could be used to do quite a number of things such as disable RSS (yeah, well I never use that feature, so I don't need it to bloat my browser) or enable some other features. In order to activate the debug menu, run the following command on your OS X terminal:

defaults write com.apple.Safari IncludeDebugMenu YES

Next, restart Safari. The new menu options set will appear on the menu bar. It's got a few fun things that am sure most of us would like to try out.

-- JPGeek.

Safari's new Web Inspector

Safari just got itself a brand new Web Inspector. I just downloaded the nightly build of the Safari engine (WebKit) to test the new inspector and all I have to say is: it's magnificent! It's beaten any web debugging / development tool I have ever used. Those are my first impressions though. I haven't had a chance to do a lot with it. The other stuff that I have noticed is the User Interface. As usual, designed with the user in mind and the Apple way. Here's a screenshot:



Take note that WebKit is available both for Microsoft Windows and Mac OS X. You can download the nightly build here: http://www.webkit.org. After installing WebKit, you will need to activate the inspector. To do this, on OS X, type the following in your terminal:

defaults write com.apple.Safari WebKitDeveloperExtras -bool true.

Restart Safari, open a website of your interest and right click on the page. In the contextual menu, choose the "Inspect Element" option.


-- JPGeek.