installing macports

If you are a programmer/developer one thing you would face on date to date basis is handling packages.
Macports is a package manager for mac using that simplifying the installation of free/open softwares on you mac.
All how to install procedure is found on
After installing the macports don’t forget to update it

sudo port -v selfupdate

Installing PEAR in Mac OSX

It looks the days of PEAR are somehow covered by the era of composer. But, still there might be things we will depend on PEAR, hence we have to install it.

Are you on Mac OSX and wants to install PEAR.. follow these simple steps and you will nail it

1. download the phar file fromĀ go-pear.phar

curl -O

2. Then run the phar file

sudo php go-pear.phar

In some cases, you might want to run it with -d detect_unicode=0 option
3. You will be provided with option that would look like the following:

1. Installation base ($prefix)                   : /Users/gullele/pear
 2. Temporary directory for processing            : /tmp/pear/install
 3. Temporary directory for downloads             : /tmp/pear/install
 4. Binaries directory                            : /Users/gullele/pear/bin
 5. PHP code directory ($php_dir)                 : /Users/gullele/pear/share/pear
 6. Documentation directory                       : /Users/gullele/pear/docs
 7. Data directory                                : /Users/gullele/pear/data
 8. User-modifiable configuration files directory : /Users/gullele/pear/cfg
 9. Public Web Files directory                    : /Users/gullele/pear/www
10. Tests directory                               : /Users/gullele/pear/tests
11. Name of configuration file                    : /Users/gullele/.pearrc

Select 1 and enter where you would want to put the installation. In my case, I put it to the common installation directory /usr/local/pear

4. After that, you will have this options to choose:

1. Installation base ($prefix)                   : /usr/local/pear
 2. Temporary directory for processing            : /tmp/pear/install
 3. Temporary directory for downloads             : /tmp/pear/install
 4. Binaries directory                            : /usr/local/pear/bin
 5. PHP code directory ($php_dir)                 : /usr/local/pear/share/pear
 6. Documentation directory                       : /usr/local/pear/docs
 7. Data directory                                : /usr/local/pear/data
 8. User-modifiable configuration files directory : /usr/local/pear/cfg
 9. Public Web Files directory                    : /usr/local/pear/www
10. Tests directory                               : /usr/local/pear/tests
11. Name of configuration file                    : /Users/gullele/.pearrc

Ideally, you can put the binaries anywhere you want but you would have to add it to the PATH to be able to access it from anywhere. But if you put it inside /user/local/bin that would automatically be taken care of – do that and that would pretty much take you to the end of pear installation.

Happey PEARing

External screen rotation on Mac book pro lion

It is customary to have more than one screen if you are a developer. On mac, I like to work on my external monitor being vertical while the main mac screen being on horizontal.

To do that, here is what you would do..

1. go to settings and produce this page



2. Hold Alt+command and click on Displays
3. you will get a box with rotation option on it:



4. Then select 90 from the rotation drop down menu and accept the confirmation.

Now restart your mac

After you restart it and when you go to display again you will see the rotation drop down manu by default there.

Untill now the main screen is the one being rotated 90 degree, but you want the external one

5. By now you will see your main window being tilted 90 degree and the external hasn’t been changed yet. But when you go to the display, you will see the rotation drop down being there – without using alt+command

6. Change the main window back to standard.

7. when you open the display you will see two dialog boxes one for each monitor. Go to the other dialog box[the external one] and just change the rotation.



If you don’t get just close the display and open it again

that will be it!

Updating Git on Mac showing previous version

Was trying to pull something to github and noticed I was using a bit old Git version.
Then I went to and downloaded for mac.
After installing, I checked if I have the latest version by doing

git --version

and it showed

git version

Then I suspected the previous one is not updated and checked which git binary is being used

which git

And it replied as


The new one is being save on another directory – /usr/local/git

Then I checked how my path is setup

echo $PATH

it was something like


As you can see the poor mac would see the /usr/bin first to check if command binary is inside it and it would continue.. so it was not checking the /usr/local/git..

Just putting the proper path infront of the path would solve the problem

export PATH=/usr/local/git/bin/:/usr/local/sbin/:$PATH

That would fix the problem. In the mean time, doing some cleanup on the existing git files would help also..

mod_rewrite not working on mac. Enabling .htaccess problem on mac

As a PHPer you would know what the mod_rewrite is and what the .htaccess file is right? if not a bit of googling would shower with a bunch of tutorials.
Now to the point:)
Being on mac do the following to enable mod_rewrite
1. Check if the module is loaded.
Navigate to apache2 folder

cd /etc/apache2

and open the conf file

sudo vi httpd.conf

Now, search for rewrite and you will and to something like this one

LoadModule rewrite_module libexec/apache2/

if it is commented out, that is if there is a #infront of it, uncomment it and exit
2. Being in the current file, search for AllowOverride and replace the “None” by “All”

3. Got to the directory /etc/apache2/users and open the conf file of your username. Like if your username is gullele, there would be file gullele.conf. Bing inside the file, search for AllowOverride and give it the value of “All”

now restart your server

sudo apachectl restart

Happy rewriting :)

Scroll bar not working on Mountain Lion Mac? Or am I crazy? Cant find scroll bars on my new mac

Yea, it is weird. I know the the safari page has long to be scrolled but I was not able to damn scroll it :)
Then this behavior was duplicated when I tried to do some stuff on the other windows as well..
Hehehee.. Apple has made the scroll bars AuToMaTiCaLlY for us :(
I have been reading this book regarding UX stuff, it is a good read.
One thing mentioned on that one is consistency of UX designs – in other words you don’t want to surprise your existing users with something that has been there kind of thing.
I might sound silly here by mentioning this and you might say “what the heck, it is not a big deal”
But, for me, I like my scroll bars and I have returned them – thanks to them they have allowed us configure it
To configure it
1. Go to system preferences
2. Be on the Personal/General
3. Select show always option from the scroll bar options.

Scroll it BABY!

Enabling PHP in Mac Mountain Lion

I have been using snow leopard and recently I got a new mac with mountain Lion. As a PHPer the first thing I was doing was to install php+mysql and I have found it much easier

here is how to enable apache for PHP:

1. go to terminal, click the launch icon from dock and you will find it in the utilities, and do
apachectrl start – you need a sudo access for this
2. Go to system preferences -> internet and wireless -> sharing and check web sharing
3. Now, go to http://localhost and verify the it works is there.
4. Then being on your editor, go to /etc/apache2 and open httpd.conf file. Then look for php5_module and uncomment that line.
5. You are done. For testing, go to /Library/Webserver/Documents/ and add a php file named phpinfo.php with content of phpinfo(); and access it from http://localhost/phpinfo.php

Happy PHP

Adding user to sudoers in Mac

Working on mac, you might find something the sudo not working as expected or something.
Specially, if you are installing to ‘somehow’ restricted folders like /usr/local/bin ..
Here is what you can do to have an sudo access:
First check the group wheel (mostly) by running the following command

ls -la /private/etc/sudoers 

This shall produce something: -r–r—– 1 root wheel 1242 Jun 22 2009 /private/etc/sudoers
This will tell you the sudoers should be in the wheel group

Then check in what group the user currently is using


From the listed groups, if wheel is not listed then add it

sudo dscl . -append /Groups/wheel GroupMembership 


SSH without password not working: mac to ubuntu

if you are doing a lot of server activities, then you are a friend of SSH.
One thing we would do would be to make ssh password-less..
I am trying to log into ubuntu server from mac client. here is the process.

on the MAC,
1. Make sure you have ssh installed. You can check using

which ssh or
ssh -v : this will tell the version

If for some reason it is not installed or if you want to upgrade it, you can install it using mac port – this would be another discussion but the overall stuff would be

$ sudo port -d selfupdate
$ sudo port install openssh

2. Now, create public/private keys using the following command

ssh-keygen -t rsa

you will find these keys in the ~/.ssh folder
This would be much you would do on the client side

On the server (ubuntu server)
1. Create the user on the server using adduser command. Let’s create user macuser

adduser macuser

then follow the instruction to create the user.
2. Go to /etc/ssh/ and update the sshd_config file
Most of the settings of this file would be responsible for the famous problem of asking the password all the time..
3. in the sshd_config file update the following:

StrictModes no
RSAAuthentication yes
PubkeyAuthentication yes
PasswordAuthentication yes

AuthorizedKeysFile      %h/.ssh/authorized_keys

After this restart the ssh using

sudo service ssh restart

Now go back to the mac client and copy the public keys to the server as follows

ssh-copy-id macuser@ubuntuServerOrIP-goes-here

here you will be asked for your password. Give the password you assigned while creating the user on the server.

Then log into the server using

ssh macuser@ubuntuServerOrIP-goes-here

if it is still asking for the password check the following

1. on the ubuntu server go to the ~/.ssh/authorized_keys and see if the public key of mac is registered
2. Check the folder’s permission level is 700 and that of autorized_keys is 600
3. Check the above setting of sshd_config file are saved and restart the ssh on the server