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 http://www.macports.org/install.php
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 http://pear.php.net/go-pear.phar

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

display

 

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

rotate

 

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.

external

 

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

that will be it!

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/mod_rewrite.so

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 :)

Installing from dmg on mac from command line

you don’t have to do this from command line as there is slick User Interface to do it. Actually, the moment you download your dmg [disk image] and double click on it, it will mounted on your system and then you can drag the icon to the application folder and boom.. you are done on installing.
This is incase if you, for whatever reason, wanted it to be done from command line.

Let’s say you downloaded a file somefile.dmg
Go to your terminal, move to the downloaded file’s folder and type

hdiutil mount somefile.dmg

This will be accompanied by the /Volume/dis-image-name confirmation from the command line.
Now search move to the newly mounted disk and copy the app file to the /Applications

cp -R /Volumes/some-file-folder/somefile.app /Applications

Yup that is it!

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