http://qs321.pair.com?node_id=1204391


in reply to Using Perlbrew macOS impossible to install distributions

Hello Anonymous Monk,

I recently encountered this problem, see this stackoverflow post. On macOS High Sierra, you need to install Berkeley DB before installing perl. If you have homebrew installed, you can install it with brew install berkeley-db.

Replies are listed 'Best First'.
Re^2: Using Perlbrew macOS impossible to install distributions
by Anonymous Monk on Nov 28, 2017 at 08:13 UTC

    THANK YOU kevbot! This solved the problem. I followed the instructions you referred to. Without I would have been lost.

Re^2: Using Perlbrew macOS impossible to install distributions
by Anonymous Monk on Nov 28, 2017 at 08:35 UTC

    Maybe you can solve my next problem too. If I want to install a new module, it fails saying that there is no permission to write in target folder. I do not see any special setting in my osMac that should prevent it. perl -v confirms I am working with the Perl version installed with Perlbrew.

    ADs-MacBook-Air:Desktop ad$ cpan Lingua-EN-Tagger Loading internal null logger. Install Log::Log4perl for logging messag +es Reading '/Users/ad/.cpan/Metadata' Database was generated on Sat, 25 Nov 2017 17:53:48 GMT Warning: You are not allowed to write into directory "/Users/ad/.cpan/ +sources/authors". I'll continue, but if you encounter problems, they may be due to insufficient permissions. Fetching with HTTP::Tiny: http://cpan.metacpan.org/authors/01mailrc.txt.gz Error downloading with HTTP::Tiny: Error: Could not create temporary f +ile /Users/fc/.cpan/sources/authors/01mailrc.txt.gz.tmp47408338328566 + for downloading: Permission denied at /Users/fc/perl5/perlbrew/perls/perl-5.26.1/lib/5.26.1/CPAN/HTTP/Cl +ient.pm line 41.

      This output looks strange to me. It appears that there are two different user accounts involved (/Users/ad and /Users/fc). It appears that you are trying to run the cpan command when you are logged into the ad account, but you installed the brewed perl in the fc account. Is that the case? I always use brewed perls from the same account that I used to install them. Try to confirm that you are using the cpan executable from your brewed perl. Typing this at the command line,

      which cpan
      should give you output like this,
      /Users/fc/perl5/perlbrew/perls/perl-5.26.1/bin/cpan

      If the output is /usr/bin/cpan, then you are still using the cpan command that is part of the system perl. After you installed perl-5.26.1 did you switch to it with the following command?

      perlbrew switch perl-5.26.1
      If you did not run the switch command then you are still using the system perl (which is probably not what you want).

      Once you confirm that you are using your brewed perl, I recommend that you install cpanminus (see App::cpanminus) using the following command,

      curl -L https://cpanmin.us | perl - App::cpanminus
      Then you can use cpanm to install modules (I find that its easier to use than the older cpan command).

        My error: I just erroneously changed fc->ad when I was editing my post (sorry). I was using the correct perl and can was the one supposed to be

        Again, your suggestion saved my day. After installing cpanminus I can install the modules like a breeze. THANK YOU

      Just one more comment in addition to kevbot's excellent post:

      You are not allowed to write into directory "/Users/ad/.cpan/sources/authors"

      This can also mean that a user other than ad has been working in that directory, for example if one has done sudo cpan in the past. If you still have the permissions problem after you've sorted out the confusion with the /Users/ad vs. /Users/fc, the simplest thing (although it'll cause a bit of re-downloading) is probably just to clobber the entire .cpan directory, making sure to back up the configuration file if you have set up a custom configuration. You may have to do sudo rm, but of course be very careful with this command!