setup mac os x (lion) as development machine ( macports: apache + mysql + php + subversion )

Filed in Mac | Open Source | Technology Leave a comment

Here are the instructions to setup Mac OS X ( Lion ) for MAMP software development. Basically you will need apache, mysql, php, subversion and may be phpmyadmin. I am using macports which simplifies the installation process.

1. Install Xcode from apple’s Mac app store. It might take a while because mac app store is very slow/pathetic. ( so don’t blame your ISP )
In this time you can download other useful softwares. My recommendation:

IM: Adium
IRC: Colloguy,
Browser: Firefox (for development), Chrome (Browsing),
Flash Player
Skype
Textmate ( if don’t use vim or emacs )

2. Download macports from http://www.macports.org and follow the installation instructions.

3. Make sure port is updated to latest

sudo port selfupdate

4. Install the packages

sudo port install subversion apache2 mysql5-server php5 +pear +mysql5 php5-xdebug phpmyadmin

Similarly if you need any other software you can install it using macport. ( if it is available on macports )

5. Load ports so that services like apache and mysql start automatically event after restart.

sudo port load apache2
sudo port load mysql5

6. Go to your browser and type http://localhost  it should display “It works”. If not then you can manually start apache and mysql.

sudo /opt/local/share/mysql5/mysql/mysql.server start

sudo /opt/local/apache2/bin/httpd -k start

Now you are all set, time to develop some kool stuff :)

, , , ,

migrate/copy mysql databases from one machine to another

Filed in Mac | Open Source | Technology Leave a comment

I am currently on Mac OS X( Snow leopard ) and have installed mysql using macports. I wanted to copy my databases to another machine Mac OS X ( Lion ) to avoid creating new db’s from fresh. Here are the instructions for the same.

Important: Information about databases is stored in below folder

/opt/local/var/db/mysql5

So basically you need to copy this folder onto your new machine.

1. First backup existing mysql5 folder. ( this is assuming you have already installed mysql using macports )

2. Copy mysql folder to /opt/local/var/db/, for this you need be sudo user.

3. Change owner

chown -R _mysql:_mysql /opt/local/var/db/mysql5

4. Restart your computer  ( I didn’t find the better way ) or may be try restarting mysql.

sudo /opt/local/share/mysql5/mysql/mysql.serve

5. When you copy databases, there is a good change that your INNODB engine might not work. So go to mysql terminal and fire

<mysql> show engines;

If it does not show INNODB or is disabled try following:

cd /opt/local/var/db/mysql5

mv ib_logfile0 ib_logfile0.bak

Basically move all ib_logfile* file to .bak files and then restart mysql server. Now go to mysql terminal and do show engines. INNODB should be enabled.

I think this instructions should work fine on any OS as long as you copy databases to correct location.

This saved me few hours and I hope it helps you too :)

, , , , ,

Samsung ML2245 (Printer configuration) on Mac OS X 10.6 (Snow Leopard)

Filed in Mac | Technology Leave a comment

Based on my previous blog, here are the instructions to configure Samsung ML2245 on Mac OS X 10.6 ( currently I am on 10.6.7 )

1. Install following drivers:

Note: First install samsung-gdi-1.816.2.dmg and follow #2 instructions. Check if your printer works. If not then install Footmatic-RIP and gplgs-8.71.dmg

You should also check http://www.openprinting.org/download/printdriver/macosx/ for latest version of above drivers.

2. Once you are done with driver installation, simply follow printer adding instructions:

http://support.apple.com/kb/HT1800?viewlocale=en_US

So now in your drivers list you will find Samsung ML2245

Hope this helps…

, , ,

Share / Broadcast wireless network using your mac pro

Filed in Mac | Technology Leave a comment

Imagine you have wifi enabled cell phone or any other device but you have only wired connection which means you cannot browse/download apps on your mobile. Well it takes just one step to setup your mac to broadcast wireless network that can be used by your other devices.

System Preferences >> Sharing >> check Internet Sharing and then apply

That’s it. Now you will be able to find your mac in available wireless networks.

, ,

Reverting a commit in svn

Filed in Mac | Technology Leave a comment

If you want to revert your commit use below command

svn merge -r [current_version]:[previous_version] [repository_url]

svn commit -m “Reverting bad commit. [previous_version]”

,

MacPorts: MySQL upgrade from 5.0.x to 5.1.x gives error during insert ( mysql_upgrade / ERROR 1558 (HY000) )

Filed in Mac | Technology 3 Comments

Yesterday I upgraded my mysql from 5.0.x to 5.1.x. After upgrade inserts started to fail with this error:

ERROR 1558 (HY000) at line 146: Column count of mysql.proc is wrong. Expected 20, found 16. Created with MySQL 50067, now running 50142. Please use mysql_upgrade to fix this error.

After little bit of google I found this solution. You need to run following command.

sudo  /opt/local/lib/mysql5/bin/mysql_upgrade -uroot -p –basedir=/opt/local/lib/mysql5/bin/mysql

This fixed my db issues. Hope this helps…

, , ,

Configure tata indicom photon+ on Mac ( Snow Leopard )

Filed in Mac | Technology 46 Comments

Tata Indicom supply drivers along with photon+ device, but it didn’t work for me on my Mac (Snow Leopard). So I had to manually download it from web.

You need following packages:

1. HUAWEI_UMTS_Dashboard_MACB301D 11SP00C03(ISO).zip (Driver) – required

- Once you install above driver it will automatically add a device “HUAWEIMobile-Modem” in your Network Preferences. Next step is to configure the device.

Configuration: Default

Telephone Number: #777

Account Name: internet

Password:internet

“Apply” your changes and then click “Connect”.

2. MobileConnectDriver(4.15.00.00).zip (Software) – optional

- You can also use this software for connecting to internet. This software gives you more details like signal strength, data transfered/downloaded etc.

, ,

Leopard (Mac OS X 10.5) to Snow Leopard (Mac OS X 10.6) upgrade problems / fixes

Filed in Mac | Technology 3 Comments

This blog post cover problems that I faced after upgrading my MacBook Pro from Leopard to Snow Leopard.

1. Firefox v 3.5.3 crashes.

- Firefox started to crashed randomly. Especially when I tried to access sites with flash content.

Solution: Few google results told me to re-install firefox and then install latest flash plugin. But that didn’t fix my problem. So finally I rebooted by system in Safe Mode. Opened firefox and then again restart in normal mode. After that I didn’t have any crash issues.

2. MacPort fails to install / compile new packages

- I have Apache, MySQL, PHP etc installed using MacPorts ( http://www.macports.org )

- So after upgrade, my MySQL stopped working from terminal. Also I got few error when I tried to upgrade few packages.

checking for iconv_open in -liconv... no
configure: error: *** No iconv() implementation found in C library or libiconv
Error: Unable to upgrade port: 1
--->  Executing: /opt/local/bin/port -uR upgrade glib2

Solution: So I again googled and found out that you need to re-install your MacPorts once you do major OS upgrade. So I followed these instructions: https://trac.macports.org/wiki/Migration. This fixed my issues.

For my macbook I have installed following ports using this command:

sudo port install apache2 mysql5-server php52 +pear +mysql5 php5-xdebug subversion

I will update this post as and when I get more issues. Hopefully there won’t be any..

, , , , ,

Detecting OS in PHP

Filed in Mac | Technology Leave a comment

Simply

echo PHP_OS;

It will print:

For Mac: Darwin

For Windows Visat: WinNT

For Ubuntu: Linux

Also if you want to know OS details about users accessing your site, you can use

$_SERVER['HTTP_USER_AGENT']


, , ,

Samsung ML1710 (Printer configuration) on Mac OS X 10.5 (Leopard)

Filed in Mac | Technology 30 Comments

I am using Mac OS X 10.5.5 and had a hard time finding drivers for our office printer Samsung ML1710. Finally i managed to configure it. Here are the instructions:

1. You need to Download & Install following drivers:

2. Once you are done with driver installation, simply follow printer adding instructions:

http://support.apple.com/kb/HT1800?viewlocale=en_US

So now in your drivers list you will find Samsung ML1710

Hope this helps…

, ,

TOP