Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things

Configuring Mac OS X to Install Perl Modules

by Perrmoss (Initiate)
on Sep 22, 2007 at 07:27 UTC ( #640489=perlquestion: print w/replies, xml ) Need Help??
Perrmoss has asked for the wisdom of the Perl Monks concerning the following question:

Despite several posts here and elsewhere, I have still not been successful in installing a Perl module (DateTime). It seems that there is some very basic stuff that I have missed. It has been surprisingly difficult to get this to work.

What I need is a step-by-step idiots guide to configure a new Mac (OS X 10.4.10) for the installation of Perl modules, in particular DateTime. When I've got it sorted for one Mac, I'm going to repeat the process for other Macs.

Note that the idiots guide MUST be something that anyone can follow, and its got to go through the entire process. What I have in mind goes as follows(its been gleaned from previous posts and websearches, and I don't claim that it is the right way or the best way to do it) and I invite your comments or suggestions;

1 Make hidden files visible. This allows you to see what's being installed and where it is being installed. Open Terminal (Applications => Utilities => Terminal) and type the command defaults write AppleShowAllFiles Yes. The next time you open a finder window, it will show the hidden files.

Note: You'll never find the likes of usr/bin/perl unless you do this.

2 Install a C compiler. Insert Mac OS X Install DVD, execute XCode Tools => XCodeTools.mpkg, follow the prompts and accept the defaults.

Note: For some reason, you need a C compiler to run and some other stuff.

3 Terminal operations (make sure your computer is connected to the internet before starting)

3a Open Terminal (Applications => Utilities => Terminal)

3b Type the command sudo perl –MCPAN –e shell

3c Input password (it's the same password as your login)

3d Do some general maintenance by typing the following commands;

install Mac::Carbon

install Bundle::LWP

install Bundle::CPAN

3e Install the module, for example by typing the following commands;

look DateTime

perl Makefile.PL

make test

Note: Having gone through this process, it is now throwing up the message Can't locate Params/ in @INC

Any help or suggestions on where I have gone wrong would be appreciated.

  • Comment on Configuring Mac OS X to Install Perl Modules

Replies are listed 'Best First'.
Re: Configuring Mac OS X to Install Perl Modules
by Corion (Pope) on Sep 22, 2007 at 07:43 UTC

    You should install DateTime the same way you installed the other modules:

    # from the shell / Terminal window cpan DateTime

    or within the CPAN shell as

    install DateTime

    DateTime needs Params::Validate as a prerequisite and the cpan program will hunt down all these prerequisites for you automatically and install them for you if you let it.

    The default CPAN configuration is to ask whether to install prerequisites, but you might want to check that or change it from ask to follow so all prerequisites get installed without asking. Type in the cpan shell:

    o conf prerequisites_policy

    check that it's ask or follow and to set the new policy to follow type

    o conf prerequisites_policy follow

    Then type

    o conf commit

    to save the current configuration if you want it to remain.

      These posts pointed me in the write direction. Hopefully, this clarification can help someone else fix this same problem.

      To install DateTime on Mac

      1. read the original post from Perrmoss and the reply by Corion for background info
      2. sudo CPAN
      3. go through configuration (if needed) press enter for most options except:
      4. choose "follow" for the prerequisite policy (instead of ask)
      5. personally, I made the recommended/common choices to some of the options (like UNINST=1)
      6. Now here's the key:

      7. Try to install DateTime. Every time you see an error, install the package that's missing by:
        • Looking for text along the lines of
        • Can't locate Params/ in @INC (@INC


          Can't locate DateTime/ in @INC (@INC

        • Take the "Params/" part and convert it to Params::Validate
        • and run the corresponding command in CPAN: install Params::Validate

      For me to get the DateTime module to install I had to run the following, first:

      install Params::Validate

      install DateTime::Locale

      install DateTime::TimeZone

      Keep following that pattern and you'll get it installed, finally!!!

        In addition to everything I wrote above, I also needed to run install Test::Exception

        So the final, full list of everything I command I ran to install DateTime on my MacBook Pro OS X 10.5.8, that has never before used perl

        1. sudo CPAN (press enter lots of times to config)
        2. install Params::Validate
        3. install DateTime::Locale
        4. install DateTime::TimeZone
        5. install Test::Exception
        6. install Test::Warn
        7. install DateTime::Format::ICal
        8. and FINALLY:

        9. install DateTime

        Sadly, I have no idea what I just did. All I know is it worked for me and I moved on to successfully finish setting up bugzilla.

        I hope this helps someone else out there (the way the posts in this thread lead me to figure this thing out)

        - Kevin G. a.k.a. gMale

Re: Configuring Mac OS X to Install Perl Modules
by syphilis (Chancellor) on Sep 22, 2007 at 08:07 UTC
    Note: For some reason, you need a C compiler to run and some other stuff

    Just a minor correction to that. You don't need a C compiler to run Makefile.PL. (Admittedly, some Makefile.PL's will check that you have a working C compiler and terminate if it can't be found.) But you will need a C compiler to perform any compilations that may be needed during the 'make' phase of the build process.

      I had expected that to be true as well, but when I tried installing a pure Perl module on a Mac OS X, I found that with the default installation the error
      make: *** No rule to make target `/System/Library/Perl/5.8.6/darwin-thread-multi-2level/CORE/config.h', + needed by `Makefile'. Stop.
      arose. This was fixed by installing the Xcode package, which contains the C compiler.

        Xcode contains more than just a compiler. In fact, if you just installed GCC, it wouldn't work.

        The actual item needed is the 'BSD Subsystem', which contains the necessary header files.

        Is that the output from running the Makefile.PL ?

        It looks to me more like something you would get from running 'make' ... when the build of perl doesn't include config.h (as is often the case with non-devel perl installations on nix-like systems).

        But I don't have Mac OS X, so I should really just shut up. (Besides, I think I might have shifted from trying to make minor corrections, to trying to split hairs :-)


Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://640489]
Approved by Corion
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (8)
As of 2017-02-22 22:33 GMT
Find Nodes?
    Voting Booth?
    Before electricity was invented, what was the Electric Eel called?

    Results (338 votes). Check out past polls.