Setup Homebrew, Perlbrew, Ruby, RVM, Perl, cpanm, nginx in Mountain Lion

This is a quick tutorial or run down to setup Homebrew, Perlbrew, Ruby, RVM, Perl, cpanm on Mountain Lion. All the softwares/programs/packages mentioned are very popular. I don’t think I have to give any description on these. I recently installed theses and it took quite effort to make all these up and running.

The first hiccup or glitch is to download the Command Line Tools for mac os. You have to be Apple developer to access this. This will install all necessary programs like make, linker, git etc.

We will then install Homebrew.

ruby -e "$(curl -fsSkL raw.github.com/mxcl/homebrew/go)"

Then I would suggest checking the installation using this

brew doctor

At this point everything should be fine. Next I would suggest installing GCC 4.2 because Mountain Lion doesn’t come with it by default.

brew tap homebrew/dupes
brew install apple-gcc42
sudo ln -s /usr/local/bin/gcc-4.2 /usr/bin/gcc-4.2

Then will install RVM and update ruby

curl -L https://get.rvm.io | bash -s stable --ruby

Now wer will install Perlbrew. Its much easier than installing it your self.

curl -kL http://install.perlbrew.pl | bash

Make sure you enter next line after install

source ~/perl5/perlbrew/etc/bashrc

Now we can install Perl

perlbrew install perl-5.16.0
perlbrew switch perl-5.16.0

Now we can install cpanm and others

perlbrew install-patchperl
perlbrew  install-cpanm
perlbrew install-ack

INSTALL local::lib

user@host:~$ cpan
cpan[1]> look local::lib
perl Makefile.PL --bootstrap=~/perl5
make && make test && make install
exit
cpan[2]> exit
echo 'eval $(perl -I$HOME/perl5/lib/perl5 -Mlocal::lib)' >>~/.bashrc
. ~/.bashrc

Install INSTALL module

cpan Module::Install

Install ELASTICSEARCH

brew install elasticsearch

To have launchd start elasticsearch at login:

ln -sfv /usr/local/opt/elasticsearch/*.plist ~/Library/LaunchAgents

Then to load elasticsearch now:

launchctl load ~/Library/LaunchAgents/homebrew.mxcl.elasticsearch.plist

Or, if you don’t want/need launchctl, you can just run:

elasticsearch -f -D es.config=/usr/local/opt/elasticsearch/config/elasticsearch.yml

you can also add jpg+png support like this

brew install libjpeg
cpanm Imager::File::JPEG

brew install libpng
cpanm Imager::File::PNG

to install PostgreSQL database driver for the DBI module

cpanm DBD::Pg

if face Installing Exporter::Declare failed kind of problem just use

cpanm --installdeps . --prompt
You can s)kip, r)etry, f)orce install, e)xamine build log, or l)ook ? [s] f

to install niginx run the following command

brew install nginx

If you see this “add /usr/local/sbin to path basbrc” and “/usr/bin occurs before /usr/local/bin” then you can add this export PATH=/usr/local/bin:/usr/local/sbin:~/bin:$PATH

nano ~/.bash_profile
export PATH=/usr/local/bin:/usr/local/sbin:~/bin:$PATH

Add the same line to .bashrc and ctrl+x -> y -> return

source ~/.bashrc
nano ~/.bash_profile
export PATH=/usr/local/bin:/usr/local/sbin:~/bin:$PATH

then ctrl+x -> y -> return

About Zakir Hyder

This entry was written by .

19. February 2013 by Zakir Hyder
Categories: Apple, Perl | Tags: , , , , , , , | Comments

Comments

  1. […] install ruby and rvm . Then we need to install http://gembundler.com. Now create a folder named “test”. […]

  2. […] use firefox version 19 and chrome version 26 with selenium-webdriver (2.31.0). I hope you installed Homebrew. It really simplifies things. Selenium include FirefoxDriver and you do not have have to add any […]

  3. […] This is a quick tutorial or run down to setup Homebrew, Perlbrew, Ruby, RVM, Perl, cpanm on Mountain Lion. All the softwares/programs/packages mentioned are very popular. I don't think I have to give any description on these. I recently installed…  […]