3

I'm trying to install Perl module MediaWiki::API using CPAN on OS X:

sudo cpan MediaWiki::API                                                        Password:
Reading '/Users/qazwsx/.cpan/Metadata'
  Database was generated on Mon, 13 Jul 2015 20:53:32 GMT
Running install for module 'MediaWiki::API'
Running make for E/EX/EXOBUZZ/MediaWiki-API-0.40.tar.gz
Checksum for /Users/qazwsx/.cpan/sources/authors/id/E/EX/EXOBUZZ/MediaWiki-API-0.40.tar.gz ok
sh: /opt/local/bin/gzip: No such file or directory
Package seems to come without Makefile.PL.
  (The test -f "/Users/qazwsx/.cpan/build/EXOBUZZ-iwzBiH/Makefile.PL" returned false.)
  Writing one on our own (setting NAME to MediaWikiAPI)

  CPAN.pm: Building E/EX/EXOBUZZ/MediaWiki-API-0.40.tar.gz

Writing Makefile for MediaWikiAPI
Writing MYMETA.yml and MYMETA.json
  EXOBUZZ/MediaWiki-API-0.40.tar.gz
  /usr/bin/make -- OK
'YAML' not installed, will not store persistent state
Running make test
No tests defined for MediaWikiAPI extension.
  EXOBUZZ/MediaWiki-API-0.40.tar.gz
  /usr/bin/make test -- OK
Running make install
Appending installation info to /Library/Perl/Updates/5.18.2/darwin-thread-multi-2level/perllocal.pod
  EXOBUZZ/MediaWiki-API-0.40.tar.gz
  /usr/bin/make install  -- OK

This is a step of installing Git-Mediawiki (see https://github.com/moy/Git-Mediawiki/wiki/User-manual). However, after all the installation steps, the first git command reports that MediaWiki::API module isn't available:

git pull
Can't locate MediaWiki/API.pm in @INC (you may need to install the MediaWiki::API module) (@INC contains: /Users/qazwsx/WorkSpace-X4430/git/perl /Users/qazwsx/WorkSpace-X4430/git/contrib/mw-to-git /Library/Perl/5.18/darwin-thread-multi-2level /Library/Perl/5.18 /Network/Library/Perl/5.18/darwin-thread-multi-2level /Network/Library/Perl/5.18 /Library/Perl/Updates/5.18.2/darwin-thread-multi-2level /Library/Perl/Updates/5.18.2 /System/Library/Perl/5.18/darwin-thread-multi-2level /System/Library/Perl/5.18 /System/Library/Perl/Extras/5.18/darwin-thread-multi-2level /System/Library/Perl/Extras/5.18 .) at /usr/local/Cellar/git/2.4.1/libexec/git-core/git-remote-mediawiki line 15.
BEGIN failed--compilation aborted at /usr/local/Cellar/git/2.4.1/libexec/git-core/git-remote-mediawiki line 15.

I wonder if my installation method for the Perl module is correct. One thing strikes out as odd is the error

sh: /opt/local/bin/gzip: No such file or directory

I use Homebrew with standard paths, so the gzip binary is at /usr/local/bin/gzip. But I don't know if or where to fix it. It appears to be some search paths issue but I don't know how to fix it.

Meng Lu
  • 13,726
  • 12
  • 39
  • 47
qazwsx
  • 25,536
  • 30
  • 72
  • 106
  • 1
    I used `cpanp` to install MediaWiki::API 0.40 on Mac OS X 10.10.4 without a problem. But I also used my own build of Perl 5.22.0 rather than the system-provided Perl (I don't tamper with the system's Perl as a matter of personal policy). – Jonathan Leffler Jul 14 '15 at 04:54
  • The reference to `/opt/local` looks like you have some remains of a MacPorts installation on your system. It's reasonably likely that that could be what's messing things up for you. – Calle Dybedahl Jul 14 '15 at 07:34
  • I've verified that `/opt/local` does not exist on my computer. – qazwsx Jul 15 '15 at 00:48
  • As you are running under `sudo`, it might be an idea to check the PATH that applies in that environment with `sudo env`. – Mark Setchell Jul 16 '15 at 20:56
  • @ JonathanLeffler Can you describe how to do that as an answer? – qazwsx Jul 22 '15 at 02:59
  • @MarkSetchell, I checked with `sudo env` and verified that `opt/local/bin` is NOT in `$PATH`. – qazwsx Jul 22 '15 at 03:00

1 Answers1

2

There might be something wrong with your ~/.cpan, the configuration for CPAN. You can try

# Re-install cpan
brew doctor
brew update
brew install cpan

# Remove or back up ~/.cpan
mv ~/.cpan ~/.cpan.bak

# Re-initialize ~/.cpan
cpan config

# Try installing the Perl module again
sudo cpan install MediaWiki::API
Meng Lu
  • 13,726
  • 12
  • 39
  • 47