Saturday, November 26, 2011

MacBook Pro with Mac OS X Lion 10.7

I got a MacBook Pro 13" for the Thanksgiving sales Friday. It's $101 off the regular price -- $1098, plus tax it's $1150. I didn't get an Air because an Air lacks wired ethernet jacket and CD/DVD drive. I'll have to buy extra accessories. Air has 128GB super fast SSD hard drive. Pro has ATA drive but it's 500GB. For 13.3" size, Pro is 2.04kg, Air is 1.35kg, which does not create a big difference for me since I don't carry laptop around often.

The current OS is called Lion, it is called Mac OS X Lion 10.7.

So far the feeling is: the 13.3" screen is indeed a little bit small, can't easily display the different windows without interfering each other. Besides a bigger screen, I also prefer a mouse instead of the touchpad. I may buy these separately later, but now let me just setup the environment first.

So now I'm installing softwares to make it a development machine. It already has php, perl, python, ruby, vi, emacs, svn, git, cvs, lex/yacc. I need to have apache, mysql, postgresql, c/c++, java, rails, gcc, make, Xcode, so that I can develop LAMP web applications, iOS applications, and c/c++/java applications.

First I need to enable root account, since many operations will need root permission. See How to Enable the "root" Account on Mac OS X. I used the "2.2 Directory Utility - (Mac OS X 10.4 or later)" method.

To setup LAMP, I referred to Setting up PHP, MySQL, and Apache in Mac OSX Leopard, and Installation of MySQL server on Apple Mac OS X 10.7 aka Lion.

To setup pear, I followed How to setup PHP Pear in Mac OS X Lion. To restore a LAMP application I wrote in the past, I need pear::DB, so I use "pear install DB" command to install it, quite easy.

When trying to make php work with mysql, I had a problem "Warning: mysql_connect(): [2002] No such file or directory (trying to connect via unix:///tmp/mysql.sock)". The solution is found in the above link.

From the above link, you may have a socket file as /tmp/mysql.sock or /var/mysql/mysql.sock but php is looking in the wrong place. Instead of moving the socket or editing config files one can just create a symbolic link so mac finds the required socket. In my case I have /tmp/mysql.sock but not /var/mysql/mysql.sock, so I used this:
cd /var
mkdir mysql
cd mysql
ln -s /tmp/mysql.sock mysql.sock

To install Xcode, I visited Downloads for Apple Developers (needs apple ID). Early versions of Xcode are also available here. The most recent version Xcode 4.2.1 was just released on 11/17/2011. Its major new features are support to iOS 5 and iCloud. But I'm a little conservative. After checking some user reviews on Xcode 4.2.1, which seem to complain about some backward incompatibility issues, I decided to go with the last one, Xcode 4.1, which was released in July. After Xcode is installed, gcc/g++/make all work.

When type "java" or "javac", Lion pops up a dialog box on installing java runtime environment. This installation seems to actually install the sdk as well, since now I can also compile java programs.

Installing rails is also by following hints of Lion. I don't know why the first time it didn't work, complaining about the missing of a ruby header file. But a second try works.

So far I don't have postgresql yet. But that's ok since I won't use it in a short time. My development environment is nearly setup after one day.

3 comments:

Yousufzai said...

Nice information, many thanks to the author. It is incomprehensible to me now, but in general, the usefulness and significance is overwhelming. Thanks again and good luck! macbook mockup

James jones said...

You could certainly see your enthusiasm in the work you write. The world hopes for more passionate writers like you who aren’t afraid to say how they believe. Always go after your heart. device mockup

Hetuwa Duminda said...

I have beeing scouring the google for this information and simply needed to thank you for the post. BTW, simply off topic, how can I get a duplicate of this theme? – Thanks android phone template

Blog Archive

Followers