Tag Archives: os x

Dropbox 2.0 in Mac ejects itself

That’s a really nice touch. After installation of Dropbox 2.0 in Mac, it ejects the .dmg for you. I do the usual — you know — after install, eject the .dmg file. I’m pleasantly surprised I don’t have to do that. That’s a great experience you gave me as a user. Although in all good intentions, I wonder does that mean applications can eject my external hard disk should they choose to.

Still it’s a nice touch and I will remember it as that. And the new user interface for Dropbox is amazing too. Kudos there:

Dropbox 2.0

With the recent USD100m acquisition of Mailbox, I am excited to see what’s coming up next.

How to install PHP 5.4 into OS X Mountain Lion

To do so, we are going to get most of the stuff from Jose Gozalez’s formulae. You will need a copy of homebrew installed, you can read about how to install homebrew here.

Let’s start by setting up the dependencies in homebrew.

brew tap homebrew/dupes
brew tap josegonzalez/homebrew-php

Now php54 is available for install through:

brew install php54 --with-mysql

To enable PHP in Apache add the following to httpd.conf and restart Apache:
LoadModule php5_module /usr/local/Cellar/php54/5.4.5/libexec/apache2/libphp5.so

The php.ini file can be found in:
/usr/local/etc/php/5.4/php.ini

If pear complains about permissions, ‘Fix’ the default PEAR permissions and config:

    chmod -R ug+w /usr/local/Cellar/php54/5.4.5/lib/php
    pear config-set php_ini /usr/local/etc/php/5.4/php.ini

After you enabled PHP in Apache, make sure you restart Apache too!

sudo apachectl restart

Troubleshooting

If you get an error that looks like this:”

configure: error: freetype.h not found.
Error: uncaught throw `Failed executing: ./configure --prefix=/usr/local/Cellar/php54/5.4.5 --disable-debug --localstatedir=/usr/local/var --sysconfdir=/usr/local/etc/php/5.4 --with-config-file-path=/usr/local/etc/php/5.4 --with-config-file-scan-dir=/usr/local/etc/php/5.4/conf.d --with-iconv-dir=/usr --enable-dba --with-ndbm=/usr --enable-exif --enable-soap --enable-sqlite-utf8 --enable-wddx --enable-ftp --enable-sockets --enable-zip --enable-pcntl --enable-shmop --enable-sysvsem --enable-sysvshm --enable-sysvmsg --enable-mbstring --enable-mbregex --enable-zend-signals --enable-dtrace --enable-bcmath --enable-calendar --with-zlib=/usr/local/Cellar/zlib/1.2.7 --with-bz2=/usr --with-ldap --with-ldap-sasl=/usr --with-xmlrpc --with-kerberos=/usr --with-libxml-dir=/usr/local/Cellar/libxml2/2.8.0 --with-xsl=/usr --with-curl=/usr --with-gd --enable-gd-native-ttf --with-freetype-dir=/usr/X11 --with-mcrypt=/usr/local/Cellar/mcrypt/2.5.8 --with-jpeg-dir=/usr/local/Cellar/jpeg/8d --with-png-dir=/usr/X11 --with-gettext=/usr/lo

It is because your freetype is not working right. It happened to me after I upgraded from Mac OS X Lion to Mac OS X Mountain Lion. To do safe, uninstall and install freetype back:

brew uninstall freetype
brew install freetype

Also if you get a permissions error, you might have to fix it:

➜  ~  brew install php54      
==> Downloading http://www.php.net/get/php-5.4.5.tar.bz2/from/this/mirror
Already downloaded: /Library/Caches/Homebrew/php54-5.4.5
==> ./configure --prefix=/usr/local/Cellar/php54/5.4.5 --disable-debug --localstatedir=/usr/local/var --sysconfdir=/usr/local/etc/php/5.4 --with-config-file-path
==> make
==> make install
==> /usr/local/Cellar/php54/5.4.5/bin/pear config-set php_ini /usr/local/etc/php/5.4/php.ini
no write access to /Users/kahwee/.pearrc!
Error: uncaught throw `Failed executing: /usr/local/Cellar/php54/5.4.5/bin/pear config-set php_ini /usr/local/etc/php/5.4/php.ini'

I changed the owner from root to kahwee (my username):

sudo chown kahwee /Users/kahwee/.pearrc

That’s all, hope it helps!

How to troubleshoot Mountain Lion’s Apache

After I install Mac OS X Mountain Lion, it seems like my Apache server can no longer start successfully:

bash-3.2# sudo tail /private/var/log/apache2/error_log
[Thu Aug 02 09:36:46 2012] [notice] caught SIGTERM, shutting down
[Thu Aug 02 09:37:57 2012] [warn] Init: Session Cache is not configured [hint: SSLSessionCache]
httpd: Could not reliably determine the server's fully qualified domain name, using kahwee-mba.local for ServerName
[Thu Aug 02 09:37:57 2012] [notice] Digest: generating secret for digest authentication ...
[Thu Aug 02 09:37:57 2012] [notice] Digest: done
[Thu Aug 02 09:37:57 2012] [notice] Apache/2.2.22 (Unix) DAV/2 mod_ssl/2.2.22 OpenSSL/0.9.8r configured -- resuming normal operations
[Thu Aug 02 09:46:17 2012] [error] [client 127.0.0.1] File does not exist: /Library/WebServer/Documents/favicon.ico
[Thu Aug 02 09:54:19 2012] [error] [client 127.0.0.1] File does not exist: /Library/WebServer/Documents/r, referer: http://home.internal.kw.sg/
[Thu Aug 02 09:54:19 2012] [error] [client 127.0.0.1] File does not exist: /Library/WebServer/Documents/favicon.ico
[Thu Aug 02 09:54:31 2012] [notice] caught SIGTERM, shutting down

To find out why, run apachectl -t:

bash-3.2# sudo apachectl -t
httpd: Syntax error on line 106 of /private/etc/apache2/httpd.conf: Cannot load /usr/libexec/apache2/mod_dav_fs.so into server: dlopen(/usr/libexec/apache2/mod_dav_fs.so, 10): Symbol not found: _dav_add_response\n Referenced from: /usr/libexec/apache2/mod_dav_fs.so\n Expected in: flat namespace\n in /usr/libexec/apache2/mod_dav_fs.so

Seems like it is caused by my disabling of mod_dav. mod_dav_fs acts as a support module for mod_dav and provides access to resources located in the server’s file system.

So I go to line 106 of /private/etc/apache2/httpd.conf and I comment out that line too.

sudo nano /private/etc/apache2/httpd.conf

Try to run the syntax check of Apache configuration again:

bash-3.2# sudo apachectl -t
Syntax OK
bash-3.2# 

That seems to be working, now we start Apache:

sudo apachectl start

Useful apachectl commands include:

  • apachectl start
  • apachectl stop
  • apachectl restart
  • apachectl -t

Hope it helps!

Mac users steered to pricier hotels

So if you’re a Mac user to get the more expensive hotels. Very smart. I am honored to be perceived as the more affluent.

On Orbitz, Mac Users Steered to Pricier Hotels

Orbitz Worldwide Inc. has found that people who use Apple Inc.’s Mac computers spend as much as 30% more a night on hotels, so the online travel agency is starting to show them different, and sometimes costlier, travel options than Windows visitors see.

The Orbitz effort, which is in its early stages, demonstrates how tracking people’s online activities can use even seemingly innocuous information—in this case, the fact that customers are visiting Orbitz.com from a Mac—to start predicting their tastes and spending habits.

This is one site I will avoid shopping. Sorry, I’m a bloody cheapskate.

Lion takes long to connect to local server

Does your /etc/hosts file look like this?

127.0.0.1 gladlycode.local gladlycast.local
127.0.0.1 babyessentials.local kw.sg.local
127.0.0.1 localhost

Every request I made to gladlyCode.local takes 5 seconds to resolve to my local Apache server. Something was wrong!

If it does and you’re on Mac OS X Lion, you should change your VirtualHost names to something else. It turns out that Mac OS X Lion no longer looks up /etc/hosts first when you try to lookup a .local domain since are technically reserved for Multicast DNS (MDNS), or Bonjour. Starting Lion, it will lookup through MDNS first, and after the 5 second timeout, it checks with /etc/hosts.

This is at a cost of developer productivity and I have to change all my .local domains to .internal.kw.sg which is a domain name I own. I figured that if it is a domain name I own, it will never clash unknowingly. I changed ‘gladlycode.local’ into ‘gladlycode.internal.kw.sg’ and point it to 127.0.0.1 now. Now testing gladlyCode no longer takes 5 seconds per request (ridiculous!).

Alternatively you can use another top level domain (TLD) instead of .local and the common ones such as .com.

How to setup PHP Pear in Mac OS X Lion

Here’s how to install PHP Pear in Mac OS X Lion 10.7 using the Apache/PHP install that comes with XCode.

Once you have PHP set up, you need to run the following installer:

kahwee-mba:Volumes kahwee$ sudo php /usr/lib/php/install-pear-nozlib.phar 
Password:
[PEAR] Archive_Tar    - installed: 1.3.7
[PEAR] Console_Getopt - installed: 1.3.0
[PEAR] Structures_Graph- installed: 1.0.4
[PEAR] XML_Util       - installed: 1.2.1
[PEAR] PEAR           - installed: 1.9.2
Wrote PEAR system config file at: /private/etc/pear.conf
You may want to add: /usr/lib/php/pear to your php.ini include_path

If your php.ini is in /etc/php.ini, open it using:

sudo nano /etc/php.ini

Should the file no exist, you may want to copy the configuration for /etc/php.ini.default over by doing the following:

sudo cp /etc/php.ini.default /etc/php.ini

Finally you will need to update the paths in your include_path in your php.ini:

...
;;;;;;;;;;;;;;;;;;;;;;;;;
; Paths and Directories ;
;;;;;;;;;;;;;;;;;;;;;;;;;

; UNIX: "/path1:/path2"
include_path = ".:/php/includes:/usr/lib/php/pear"
...

After this, you can install PHP Pear packages. This is used if you want to install Numbers_Words package:

sudo pear install channel://pear.php.net/Numbers_Words-0.16.2

Have fun.