2

SHORT QUESTION

I've installed cpanm on Mac mini G4 Leopard 10.5.8 with perl-8.8.8 using /usr/bin/cpan -i App::cpanminus and then **sudo** /usr/bin/cpan -i App::cpanminus It said App::cpanminus is up to date. but no cpanm is available in /usr/bin or anywhere else.

NOTE I've looked up the questionCan't locate module in @INC but CPAN says module is up to date and some others which seemed related to my case but they didn't help. Not much information is available in Google searches either.

LONG QUESTION

I've installed cpanm on Mac mini G4 Leopard 10.5.8 with perl-8.8.8 using /usr/bin/cpan -i App::cpanminus

All the downloading, extracting, compiling, etc went smoothly but at the last step, before installing it as (As Far As I Can Remember / AFAICR) /usr/bin/cpanm it stopped with a permission error (AFAICR) So I've repeated the same line with sudo:

~ $ sudo /usr/bin/cpan -i App::cpanminus

this time it said (again, AFAICR)

CPAN: Storable loaded ok
Going to read /Users/Mac/.cpan/Metadata
  Database was generated on Thu, 09 Dec 2021 18:17:02 GMT
App::cpanminus is up to date.

and it didn't place the cpanm into /usr/bin or any other PATH directory.

Note that I need to use solely perl, v5.8.8 because it is the only version compatible with some of the system level Perl applications.

When I did a search on the ~/.cpanm and the default Mac OS X Perl installation folder which is /System/Library/Perl no instance of cpanm was found. So I gather cpanm is not created at all.

I've deleted the /Users/Mac/.cpan and repeated the sudo install and it ended up with the same message above (again, AFAICR)

So I got stuck in this. I didn't do anything else other than deleting ~/.cpan

How to install cpan on this Mac ?

Note 2 My question's title might not be best. Anyone is free to edit the title or the question.

Edit 1

I've tried the -f option but it said unknown option f Here is how it goes:

~ $ sudo /usr/bin/cpan -if App::cpanminus
Unknown option: f
CPAN: Storable loaded ok
Going to read /Users/Mac/.cpan/Metadata
^C
~ $ sudo /usr/bin/cpan -f App::cpanminus
Unknown option: f
CPAN: Storable loaded ok
Going to read /Users/Mac/.cpan/Metadata
^C
~ $ sudo /usr/bin/cpan -f -i App::cpanminus
Unknown option: f
CPAN: Storable loaded ok
Going to read /Users/Mac/.cpan/Metadata
  Database was generated on Thu, 09 Dec 2021 18:17:02 GMT
CPAN: LWP::UserAgent loaded ok
Fetching with LWP:
  http://www.cpan.org/authors/01mailrc.txt.gz
Going to read /Users/Mac/.cpan/sources/authors/01mailrc.txt.gz
Fetching with LWP:
  http://www.cpan.org/modules/02packages.details.txt.gz
Going to read /Users/Mac/.cpan/sources/modules/02packages.details.txt.gz
  Database was generated on Fri, 10 Dec 2021 19:29:02 GMT

  There's a new CPAN.pm version (v2.29) available!
  [Current version is v1.7602]
  You might want to try
    install Bundle::CPAN
    reload cpan
  without quitting the current session. It should be a seamless upgrade
  while we are running...

Fetching with LWP:
  http://www.cpan.org/modules/03modlist.data.gz
Going to read /Users/Mac/.cpan/sources/modules/03modlist.data.gz
Going to write /Users/Mac/.cpan/Metadata
App::cpanminus is up to date.

And surely enough there's still no cpanm installed.

Edit 2

Output of the cpan -D App::cpanminus (only the meaningful lines included)

Would you like to configure as much as possible automatically? [yes] yes
Reading '/Users/Mac/.cpan/Metadata'
  Database was generated on Fri, 10 Dec 2021 19:29:02 GMT
App:cpanminus
-------------------------------------------------------------------------
    (no description)
    M/MI/MIYAGAWA/App-cpanminus-1.7044.tar.gz
    (no installation file)
    Installed: not installed
    CPAN:      1.7044  Not up to date
    Tatsuhiko Miyagawa (MIYAGAWA)
    miyagawa@bulknews.net
Terry
  • 1,206
  • 1
  • 10
  • 26
  • *"but no cpanm is available in /usr/bin or anywhere else"* : I tried to install `cpanm` like you on macOS 12.0.1, as you can see from my [install log](https://pastebin.com/7SpuBUeH), it installed `cpanm` into `/usr/local/bin/` and the module `App::cpanmiunus` in `/Library/Perl/5.30/App/cpanminus.pm`. Can you check if you got anything in those directories? – Håkon Hægland Dec 10 '21 at 21:49
  • I've just checked the `/usr/local/bin` and cpanm is nowhere. I've checked `/Library/Perl` again it's nowhere. I've searched the whole `/usr` again nowhere. That cpanm is nowhere to be found. – Terry Dec 10 '21 at 22:39
  • Try executing just `sudo /usr/bin/cpan` without any arguments. It should give you a prompt. At the prompt, type `force install App::cpanminus` and post the output here. – Ed Sabol Dec 20 '21 at 17:26

1 Answers1

2

A few things to note:

  • The cpan output should tell you where it installed things. Do you have the output? To try again, you can force install with cpan -f to see what happened.

  • The .cpan/ directory is just a work directory for CPAN.pm. However, you can go into its build/ directory and find the directory for the thing you are having trouble with to look at its build files. The Makefile will have settings such as INSTALLBIN and INSTALLSITEBIN (and some others) that notes where it decided to install things. Apple has typically set these to whatever they wanted for you already, so it's slightly different than the default perl behavior.

  • You've likely installed the cpanm script in one of perl's directories. Perl modules typically do not install into a common directory without you doing something special. There's likely a bin directory at the same level as the lib/ directory. See where you installed the module and then look for that bin/

$ cpan -D App::cpanminus
Loading internal logger. Log::Log4perl recommended for better logging
Reading '/Users/brian/.cpan/Metadata'
  Database was generated on Fri, 10 Dec 2021 19:29:02 GMT
App::cpanminus
-------------------------------------------------------------------------
    (no description)
    M/MI/MIYAGAWA/App-cpanminus-1.7044.tar.gz
    /usr/local/perls/perl-5.34.0/lib/site_perl/5.34.0/App/cpanminus.pm
    Installed: 1.7044
    CPAN:      1.7044  up to date
    Tatsuhiko Miyagawa (MIYAGAWA)
    miyagawa@bulknews.net

$ ls -l /usr/local/perls/perl-5.34.0/bin/cpanm
-r-xr-xr-x  1 brian  wheel  302800 Jun 23 18:53 /usr/local/perls/perl-5.34.0/bin/cpanm
  • I like to leave the Perl programs in that bin directory and make links to them if I want them somewhere else in my path (Make links to per version tools.

  • The -i switch to cpan is just extra typing. It's implied in almost every case where you would use it.

  • You get the permission error because you are using the system Perl and installing things into the directories it set up. Apple is pretty good about segregating that, but I don't remember how well they were doing that back then. A system update (heh, in your case unlikely ;) might overwrite or delete your work. Many people use a separate, user-installed perl and pretend the system perl does not exist.

brian d foy
  • 129,424
  • 31
  • 207
  • 592
  • Thank you for the answer. For the 1st section, see the edit 1 which I've added to the question (cpan -f is problematic on this Mac, too) For the 2nd section, there's no _build_ directory under `~/.cpan` There's only a Metadata file and a sources folder and no _build_ dir thereunder. For the 3rd section, see the edit 2. I didn't know `-i`switch could be dropped. Good to know. – Terry Dec 10 '21 at 23:20
  • What happens when you install a modern CPAN.pm? – brian d foy Dec 11 '21 at 03:28
  • I've lost hope on the `cpan` and decided to install `cpanm` manually i.e. I've downloaded the tar.gz package and did `/usr/bin/perl Makefile.PL` and `make` and `cpanm` is installed finally. Then I've done `/usr/bin/cpanm FCGI` (FCGI is the ultimate target) It didn't install (couldn't pass the test) So I've performed a manual install for the FCGI too. It stopped with `cc1 error: unrecognized command line option -Wno-error...` Surely this is compiler specific. Upgraded gcc to 4.2 and it compiled fine and FCGI is installed, finally. Phew :) – Terry Dec 11 '21 at 18:30
  • Yeah, you are on a pretty old system there, so it's difficult to provide support. – brian d foy Dec 11 '21 at 18:37