Category Archives: Mac OS X

Install PHPUnit in Mac OS X with pear

sudo pear channel-discover pear.phpunit.de
sudo pear install phpunit/PHPUnit

Install and activate xdebug in MacPorts

First install php5-xdebug:

sudo port install php5-xdebug

Then just add these in your php.ini (probably /opt/local/etc/php5/php.ini), but first verify the file path for zend_extension option:

; NOTE: This line adds the xdebug extension. The macports install will give you the path, 
; or may even add this automatically. Be smart, look for a similar line in your config first.
; (Edit: 06/22/2012)
zend_extension="/opt/local/lib/php/extensions/no-debug-non-zts-20090626/xdebug.so"

; General config
;Dumps local variables on exception
xdebug.show_local_vars=On
;Dump server variables
xdebug.dump.SERVER=*
;Dump global variables
xdebug.dump_globals=On
xdebug.collect_params=4;

; Tracing
xdebug.auto_trace=On
xdebug.trace_output_dir=/opt/local/php_traces/
xdebug.show_mem_delta=On
xdebug.collect_return=On

; Profiler
xdebug.profiler_enable=1
xdebug.profiler_output_dir=/opt/local/php_traces

; Debugging. You might need to specify your host with some additional options
xdebug.remote_enable=1

Ref: http://www.littleblackhat.com/blog/2009/02/getting-xdebug-working-on-mac-os-x-with-macports/

Install Doctrine2 with PEAR in MacPorts

Run those commands:

sudo /opt/local/bin/pear channel-discover pear.doctrine-project.org
sudo /opt/local/bin/pear channel-discover pear.symfony.com
sudo /opt/local/bin/pear install -a pear.doctrine-project.org/DoctrineORM-2.3.3
sudo /opt/local/bin/pear install pear.doctrine-project.org/DoctrineSymfonyConsole
sudo /opt/local/bin/pear install pear.doctrine-project.org/DoctrineSymfonyYaml

Then running doctrine -v should work but /opt/local/lib/php must be in the include_path of your PHP installation. I tried to include it in my /opt/local/etc/php5/php.ini file but didn’t work, so I added this line as the very first line in /opt/local/bin/doctrine.php:

set_include_path(get_include_path() . PATH_SEPARATOR . '/opt/local/lib/php');

Then everything worked fine.

Ref: http://delboy1978uk.wordpress.com/2012/06/26/installing-doctrine-2-2-2-on-mac-os-x/

Useful Apache 2 and MySQL 5 service aliases for MacPorts

Those are some aliases I use to start, stop and restart Apache 2 and MySQL on my MacPorts installation done with the installation script I made some time ago. You have to edit “~/.bash_profile” file and add those lines:

alias mysql5start='sudo /opt/local/etc/LaunchDaemons/org.macports.mysql5/mysql5.wrapper start'
alias mysql5stop='sudo /opt/local/etc/LaunchDaemons/org.macports.mysql5/mysql5.wrapper stop'
alias mysql5restart='sudo /opt/local/etc/LaunchDaemons/org.macports.mysql5/mysql5.wrapper restart'

alias apache2start='sudo /opt/local/etc/LaunchDaemons/org.macports.apache2/apache2.wrapper start'
alias apache2stop='sudo /opt/local/etc/LaunchDaemons/org.macports.apache2/apache2.wrapper stop'
alias apache2restart='sudo /opt/local/etc/LaunchDaemons/org.macports.apache2/apache2.wrapper restart'

Then execute “source ~/.bash_profile” to load the new aliases or just open a new terminal window.

Turn on syntax highlighting for vi and vim in Mac OS X

Turning syntax highlighting for vi and vim in Mac OS X is as simple as creating a file called “.vimrc” in your home folder with the following content:

set nocompatible
syntax on

terminal

You may not like the standard color highlighting schema, but it can be easily changed. For example open some “.php” file and type :colorscheme followed by an space and the hit the tab key (or shift-tab to go backwards). You will see the different color schema names available in the system and then if you hit enter you’ll se immediately how it changes to the one you selected.

You can also set your default color highlighting schema in the “.vimrc” with “colo schemaname“:

set nocompatible
syntax on
colo default

The available schema names are those folder names inside the folder “/usr/share/vim/vimXX/” (the XX are 2 numbers that change for version to version of Mac OS X) without the “.vim” extension:

$ ls /usr/share/vim/`echo vim[0-9][0-9]`/colors/*.vim
/usr/share/vim/vim73/colors/blue.vim
/usr/share/vim/vim73/colors/darkblue.vim
/usr/share/vim/vim73/colors/default.vim
/usr/share/vim/vim73/colors/delek.vim
/usr/share/vim/vim73/colors/desert.vim
/usr/share/vim/vim73/colors/elflord.vim
/usr/share/vim/vim73/colors/evening.vim
/usr/share/vim/vim73/colors/koehler.vim
/usr/share/vim/vim73/colors/morning.vim
/usr/share/vim/vim73/colors/murphy.vim
/usr/share/vim/vim73/colors/pablo.vim
/usr/share/vim/vim73/colors/peachpuff.vim
/usr/share/vim/vim73/colors/ron.vim
/usr/share/vim/vim73/colors/shine.vim
/usr/share/vim/vim73/colors/slate.vim
/usr/share/vim/vim73/colors/torte.vim
/usr/share/vim/vim73/colors/zellner.vim

My favorite one is “peachpuff”.

Ref: http://igoles.wordpress.com/2006/09/01/anadiendo-color-a-vim-en-mac-os-x/
http://alvinalexander.com/linux/vi-vim-editor-color-scheme-colorscheme

  • Page 1 of 5
  • 1
  • 2
  • 3
  • 4
  • 5
  • >