16

Simple question: How to install CPAN modules on OS-X like normal Linux/Unix way?

I just want to type in cpan something like install Perl6::Say for example.

15

Open the /Applications/Utilities/Terminal.app and you have a unix prompt.

Both perl and cpan ship with OS X so you have nothing to install unless you want a different version of them than ships with your particular version and build of OS X.

Air:~ me$ cpan Perl6::Say
Sorry, we have to rerun the configuration dialog for CPAN.pm due to
some missing parameters...  Will write to
 <</Users/me/.cpan/CPAN/MyConfig.pm>>
  • 1
    Depending on the modules you want to install you may need to install Xcode as well so a compiler is available. Install Xcode before running cpan for the first time. If you've already configured cpan you may need to re-run it with cpan config so it picks up the compiler. – Ian C. Dec 18 '12 at 16:37
  • i'm trying, but always have status 'make or install: NO'. am i need to use sudo? but i want only for current user, not root all modules – gaussblurinc Dec 18 '12 at 16:37
  • Why not ask a follow on question. List exactly the module you want to install and exactly the error message you get. You may be missing the command line tools that Xcode can install or you may have another error. We like narrow, specific, answerable questions here. It's free to ask another question, so why not leave this as a signpost for how to get started and ask another on how to interpret a specific error message. I'll edit my answer to show that with Xcode and the command line tools installed, this works for a user install. – bmike Dec 18 '12 at 16:51
  • Please note that you don't need to add install on the command line for cpan. All you have to do is cpan Perl6::Say. If you include install it will try to install a module called install, which for this reason is an empty module, see metacpan.org/pod/install. – simbabque May 21 at 14:38
  • 1
    @simbabque I had no idea I was wrong there. Please feel you can edit my posts to fix this sort of thing and then leave an edit comment or a comment why you fixed it. I appreciate the correction! – bmike May 21 at 17:35
9

You might be interested in perlbrew to manage local perl installations and cpan modules without interfering with perl included with the system or needing to use sudo to install cpan modules.

  • This is a very nice solution for someone that cares not to install Xcode or other command line tools. – bmike Dec 18 '12 at 16:51

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .