Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options

Using Perlbrew macOS impossible to install distributions

by Anonymous Monk
on Nov 26, 2017 at 13:31 UTC ( #1204276=perlquestion: print w/replies, xml ) Need Help??

Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hi Monks

I've been programming with Perl for years on Windows (ActiveState and Strawberry). Now I need to move to macOS (High Sierra, Xcode installed for what that it can matter) and having big, big problems even to get started! As I didn't want to mess up the already installed version of Perl, I installed Perlbrew. The Perlbrew installation seems to be fine. To start using Perlbrew, I open the Terminal and write source ~/perl5/perlbrew/etc/bashrc At this point I can use the command Perlbrew. If I try to install Perl I use:

 ADs-MacBook-Air:~ ad$ perlbrew install 5.22.0

The installation begins and after a quite long time I get the following error message

Installing /Users/fc/perl5/perlbrew/build/perl-5.22.0 into ~/perl5/per +lbrew/perls/perl-5.22.0 This could take a while. You can run the following command on another +shell to track the status: tail -f ~/perl5/perlbrew/build.perl-5.22.0.log Installation process failed. To spot any issues, check /Users/fc/perl5/perlbrew/build.perl-5.22.0.log If some perl tests failed and you still want to install this distribut +ion anyway, do: (cd /Users/fc/perl5/perlbrew/build/perl-5.22.0; make install) You might also want to try upgrading patchperl before trying again: perlbrew install-patchperl Generally, if you need to install a perl distribution known to have mi +nor test failures, do one of these command to avoid seeing this message perlbrew --notest install 5.22.0 perlbrew --force install 5.22.0

I tried to install a few of Perl version and I get always the same error. I haven't forced installation yet, because I thing I should be able to install it without forcing it. Upgrading patchperl has been already performed. The log file is so long I do not see anything it helps me. However this are the last lines, maybe they say something to you:

est Summary Report ------------------- ../cpan/DB_File/t/db-hash.t (Wstat +: 512 Tests: 116 Failed: 26) Failed tests: 23-25, 27-28, 30, 37, 45-46, 68, 70, 72-77 82, 84, 86, 89-90, 98, 101, 106, 112 Non-zero exit status: 2 Parse errors: Bad plan. You planned 166 tests but ran 116. Files=2377, Tests=708513, 3749 wallclock secs (47.71 usr 9.17 sys + 3 +30.63 cusr 60.11 csys = 447.62 CPU) Result: FAIL make: *** [test_harness] Error 26 ##### Brew Failed #####

Why I am having so many problems starting to use Perl on a Mac while on a Windows I never experienced anything like this (i.e. everything works for me out-of-the-box)?

Replies are listed 'Best First'.
Re: Using Perlbrew macOS impossible to install distributions
by karlgoethebier (Monsignor) on Nov 26, 2017 at 15:01 UTC

    I'm a perlbrew aficionado and mac user - but from what you posted it seems to be impossible to figure out what wents wrong. Are you sure that you installed perlbrew right? What does perlbrew info say?

    If i were in your shoes i would throw away the perlbrew installation and - after thoroughly rereading it's friendly manual - start over again. You must make sure that your setup of perlbrew is OK.

    BTW, just an idea: Xcode Command Line Tools are properly installed? As far as i remember they are not installed if you just install Xcode.

    Best regards and good luck, Karl

    P.S.: And yes: Steve was right. It just works ;-)

    «The Crux of the Biscuit is the Apostrophe»

    perl -MCrypt::CBC -E 'say Crypt::CBC->new(-key=>'kgb',-cipher=>"Blowfish")->decrypt_hex($ENV{KARL});'Help

Re: Using Perlbrew macOS impossible to install distributions
by 1nickt (Abbot) on Nov 26, 2017 at 14:06 UTC

    Why I am having so many problems ...

    Hi, sorry to say the answer to that question is almost certainly "because you made some mistake(s)".

    You are quite right that you should not have to, and should not, force installation of a Perl version under perlbrew.

    It's really impossible to say from here what the issue is -- only that perlbrew problems always come down to paths, permissions, or both.

    I can say that if you follow the documentation exactly it will indeed just work. You may have run something as root when not required, or vice-versa, or may have tried to manually do something ("upgrading patch perl has already been performed" ... should not be needed), or something else.

    What I do with OS X is to remove my perls and my development one step further away from the system installation, by using a Linux virtual machine. See VirtualBox and Vagrant. It's very easy and quick. You can get prebuilt images for any flavour you like. If you use Vagrant you can share a directory between the host OS X system and your VMs so you can read/write to docs in both sessions simultaneously.

    One of the main advantages to this approach is that if you screw up your system badly when getting it set up, you can just destroy it and start again. And then, once you have a base machine set up as you like it (including perlbrew and a perl or more, all your apps and resources, etc., you can save a copy and clone from it when building new VMs.

    A final advantage, depending on how messed up is the system perlbrew installation, is that you could abandon it as is: the system still has the system perl, and in your VMs you are building from scratch. So that would at least get you going sooner, perhaps.

    Hope this helps!

    The way forward always starts with a minimal test.

      "What I do with OS X is to remove my perls and my development one step further away from the system installation, by using a Linux virtual machine."

      Every developer I know who uses a Mac tells me this. What's the advantage of a Mac in terms of hardware/software if you're just spinning up a Linux VM to work?

        Hi marto,

        What's the advantage of a Mac in terms of hardware/software if you're just spinning up a Linux VM to work?

        There is none any longer. It used to be that the hardware advantage was the Retina monitor, but now there are plenty of vendors that provide nice 4K screens on 13" or 14" laptops.

        Now, on the contrary, the Macbooks have fallen behind in hardware, offering less RAM and disk space and slower chips and disks than competitor systems.

        My latest machine is a Lenovo Yoga 910 which I bought with Windows 10 but never booted before wiping and installing Ubuntu. It has 16GB Ram and a 1Tb SSD drive, as well as 4K screen. It flipping screams.

        Many devs working at a $company choose to use a Mac with Linux VM because the IT dept insists on having a bunch of spyware, errr, corporate security tools, on the machine, so it's a choice between Windows or Mac.

        (In a week from today I'll be getting a new laptop from $newjob -- the manager strongly suggests Macbook with VMs, having himself just switched from native Linux, lol. I don't prefer it as the VirtualBox app on the Macbook always seems to get too hot eventually (consuming all system RAM) and you wind up having to reboot the entire thing or at least the VM platform. I don't have this problem running desktop Ubuntu on the Lenovo (always did used to have problems with a Linux GUI, things have improved). So, I plan to try to get a Linux machine, maybe they will offer the Dell. If not, I plan to bork a Windows machine and install Ubuntu, if I can get a client for the VPN. Will report back.)

        The way forward always starts with a minimal test.

        I develop on Mac. It never remotely occurred to me that I might need a Linux VM on it. Never installed one. OS X is Unix.

Re: Using Perlbrew macOS impossible to install distributions
by marto (Archbishop) on Nov 26, 2017 at 14:02 UTC

    it just works!. In all seriousness there's a world of difference between downloading tools someone has prebuilt for you and compiling things yourself. Check the tests that reported failures, do any of the issues discussed in the README apply here?

Re: Using Perlbrew macOS impossible to install distributions
by kcott (Bishop) on Nov 27, 2017 at 04:16 UTC
    "Using Perlbrew macOS impossible to install distributions"

    That's an erroneous generalisation. I've been installing Perl distributions on macOS (previously Mac OS X) since either v10.5.x or v10.6.x; the latest was on v10.12.5. I think "High Sierra" is v10.13.x: I don't have this upgrade yet, but I haven't encountered any reports of specific Perlbrew problems with this macOS version. I currently have all of these distributions installed:

    $ perlbrew list perl-5.14.0t perl-5.14.2 perl-5.14.2t perl-5.18.0t perl-5.18.1t perl-5.20.0t perl-5.20.2t perl-5.22.0t perl-5.24.0t perl-5.25.9t * perl-5.26.0t

    So, that includes the 5.22.0 you say you're having problems with; maybe there are others in that list which you've tried as well (you didn't specify what others you'd tried).

    "To start using Perlbrew, I open the Terminal and write source ~/perl5/perlbrew/etc/bashrc"

    I've never needed to do this; although, to be perfectly honest, I'm not entirely sure what you mean by this (I can make an educated guess, but it's still only a guess). If you put command line commands and output within <code>...</code> tags, as I did with "perlbrew list" above, it'll make what you're actually doing a lot clearer.

    Almost at the end of my "~/.bash_profile", I have:

    . $HOME/.bashrc

    My "~/.bashrc" starts with:

    . ~/perl5/perlbrew/etc/bashrc

    Perhaps you need something similar to this.

    You can also take a look at this post of mine from last month: the underlying issue is unrelated to your problem but it does show how I normally perform installations. When I use this method, "everything works for me out-of-the-box".

    — Ken

      Mmh, if the Op's ENV looks like this...

      karls-mac-mini:~ karl$ env | grep PERLBREW PERLBREW_VERSION=0.58 PERLBREW_PERL=perl-5.18.0 PERLBREW_BASHRC_VERSION=0.58 PERLBREW_ROOT=/Users/karl/perl5/perlbrew PERLBREW_HOME=/Users/karl/.perlbrew PERLBREW_MANPATH=/Users/karl/perl5/perlbrew/perls/perl-5.18.0/man PERLBREW_PATH=/Users/karl/perl5/perlbrew/bin:/Users/karl/perl5/perlbre +w/perls/

      ...everything should be OK with perlbrew, right? Very strange...

      Best regards, Karl

      «The Crux of the Biscuit is the Apostrophe»

      perl -MCrypt::CBC -E 'say Crypt::CBC->new(-key=>'kgb',-cipher=>"Blowfish")->decrypt_hex($ENV{KARL});'Help

        G'day Karl,

        I read what you've written several times but the point you're trying to make eludes me. I was particularly stumped by your final words: "Very strange...".

        The OP shouldn't need to manually source '~/perl5/perlbrew/etc/bashrc' in order to use Perlbrew. Doing this will set up environment variables such as you've shown, but only in the current shell. It's a tedious task that's easy to forget and therefore error-prone: hence my suggestion to set up something similar to my '.bash_profile' and '.bashrc'.

        I set all this up for myself years ago and haven't needed to change anything since. While I don't remember specifics, I do recall all instructions came from Perlbrew documentation: I didn't need to seek out secret incantations in dark corners of the Internet.

        For what it's worth, except for some obvious and expected differences (e.g. s/karl/ken/), my environment looks very similar to yours.

        — Ken

Re: Using Perlbrew macOS impossible to install distributions
by kevbot (Priest) on Nov 28, 2017 at 07:22 UTC

    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.

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

      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: 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 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,

        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 | perl - App::cpanminus
        Then you can use cpanm to install modules (I find that its easier to use than the older cpan command).

        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!

Re: Using Perlbrew macOS impossible to install distributions
by kevbot (Priest) on Nov 28, 2017 at 14:34 UTC

    I just wanted to follow-up on my other post Re: Using Perlbrew macOS impossible to install distributions. The stackoverflow thread mentioned that the bug had been reported to However, I searched (using the public interface) and I did not find the relevant bug report. So, I searched around some more and it appears that this might be a bug in macOS High Sierra (10.13), see this Apple Discussion thread. It seems that the problem is still not fixed in macOS version 10.13.1 (since I still get the test failures on 10.13.1 unless I install Berkeley DB first).

Re: (also solved) Using Perlbrew OS X
by Your Mother (Bishop) on Nov 26, 2018 at 23:52 UTC

    Follow-up. I hit this exact issue today. New Mac, wanted to try some signature stuff so needed to update perl. Picked 5.28. Failed at ../cpan/DB_File/t/db-hash.t, as reported. As 1nickt and kevbot suggest, brew install berkeley-db cleared the way for it to install cleanly.

      I encountered this same scenario today. brew install berkeley-db was the fix for me as well.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1204276]
Approved by 1nickt
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (5)
As of 2019-10-18 19:01 GMT
Find Nodes?
    Voting Booth?