Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re^2: Establishing a beachhead and acquiring privileges on a Mac-mini

by Aldebaran (Curate)
on May 05, 2023 at 23:36 UTC ( [id://11152007] : note . print w/replies, xml ) Need Help??


in reply to Re: Establishing a beachhead and acquiring privileges on a Mac-mini
in thread Establishing a beachhead and acquiring privileges on a Mac-mini

You must have heard this before: don't use the system Perl on Mac; it's for the system.

Yeah, but it goes in one eye and out the other until I actually have a Mac. Here's output from the above scripts:

/System/Library/Perl/5.30/AnyDBM_File.pm AnyDBM_File.pm access age in days: 30.07 /System/Library/Perl/5.30/sigtrap.pm sigtrap.pm access age in days: 30.07 /System/Library/Perl/5.30/SelectSaver.pm

I was fine with perl being 5.30, and the truth of the matter is that I do not know the perl command to update itself. I'm left to surmise that it's implementation-dependent. hippo polled the question: why don't you have the latest perl, and my answer was that I have to change architecture to change perl. I get the system up to snuff by getting the perl up to snuff first, so that I can understand where the hell am I on a new box, real or virtual. It is clear that a lot of OS X's architecture looks like this rather than being contained places typical for linux.

Install Perlbrew from http://perlbrew.pl and install your own Perl that you can mess with to your heart's desire.

I'm trying another thesis here, namely homebrew, and I see a possible conflict with layering perlbrew. I'm hoping that I have it on "set and forget."

Also, bash works fine on Mac. Do chsh -s /bin/bash to change.

I was ready to make this change back. Things have gotten better for me as a whole system since I bit the bullet and got a trackpad. So I'm not jones'ing for a right-click anymore. I've even done my first iMovie. Yes, part of the reason I want to be able to do all of this is to be able to make a TikTok video. Phones are too small for me, and I wanted to match architecture for the phone, where I have again rejoined the apple-verse to flee google and android. (Out of the frying pan, into the fire....)

I don't think I've got the install right until I can get cpanm, though, and I seem to be stuck:

(CPAN::Version........v5.5003) 459 subroutines redefined cpan shell -- CPAN exploration and modules installation (v2.33) Enter 'h' for help. cpan[3]> install cpanm + Warning: Cannot install cpanm, don't know what it is. Try the command i /cpanm/ to find objects with matching identifiers. cpan[4]>

What's the deal? Is cpanm a bad idea for Macs, or am I missing something obvious to the more-experienced?

Cheers,

Replies are listed 'Best First'.
Re^3: Establishing a beachhead and acquiring privileges on a Mac-mini
by kcott (Archbishop) on May 07, 2023 at 02:16 UTC

    G'day Aldebaran,

    "... I do not know the perl command to update itself."

    Having been advised against using the system Perl on Mac, you wouldn't be doing this even if Perl had such a command. Correct?

    I used Perlbrew on Mac for about nine years and never had any problems. I changed to Cygwin on Win10 about five years ago; still using Perlbrew and still having no problems.

    Following links from Perlbrew, you'll eventually get to CPAN: perlbrew. Here you'll find documentation for perlbrew commands; in the context of the current discussion, the most pertinent are probably install, upgrade-perl, and install-cpanm.

    Once you have Perlbrew installed, you can easily switch between whatever versions of Perl you have; e.g.

    $ perl -v | head -2 | tail -1 This is perl 5, version 36, subversion 0 (v5.36.0) built for cygwin-th +read-multi $ perlbrew switch perl-5.32.0 $ perl -v | head -2 | tail -1 This is perl 5, version 32, subversion 0 (v5.32.0) built for cygwin-th +read-multi $ perlbrew switch perl-5.36.0 $ perl -v | head -2 | tail -1 This is perl 5, version 36, subversion 0 (v5.36.0) built for cygwin-th +read-multi

    I recommend using the following shebang in your scripts.

    #!/usr/bin/env perl

    This means that the script will use whatever Perl version is current.

    $ cat test_shebang.pl #!/usr/bin/env perl print $^V; $ ./test_shebang.pl v5.36.0 $ perlbrew switch perl-5.33.5 $ perl -v | head -2 | tail -1 This is perl 5, version 33, subversion 5 (v5.33.5) built for cygwin-th +read-multi $ ./test_shebang.pl v5.33.5

    — Ken

      I recommend using the following shebang in your scripts.

      I wish I had seen your reply before I reposted.

      #!/usr/bin/env perl

      fixed me entirely, thanks...I'll take another look at perlbrew, but I honestly have to pick my battles. It's all going much slower than I wanted, but I'm finally getting something like a toolchain started. Good to know that it can be done without conflict.

        "fixed me entirely, thanks"

        Glad I could help.

        "I'll take another look at perlbrew, but I honestly have to pick my battles."

        As I indicated in my previous post, it's been five years since I've used a Mac; my information could be out-of-date. Having said that, for the nine years that I did use Mac, upgrades to the system would typically wipe out older versions of Perl and replace them with newer ones: this would not only delete the core Perl code but also any modules that the user may have installed with that version. You could potentially lose a lot; recovery may be problematical; and, the old Perl version is no longer available to you (which may or may not be important).

        In addition, installing modules in the system Perl may have subtle side-effects. For instance, you install X::Y::Z; this has a dependency of A::B::C with a version greater than what comes with the system Perl; the installation of X::Y::Z automatically upgrades A::B::C; this may potentially change how the system Perl works; in turn, this could affect how the O/S works, possibly with dire consequences.

        I'd guess Perlbrew is the most used but there are other options (with which I'm not overly familiar); as I know Perlbrew, and have used it successfully for well over a decade, it's what I recommend. Choose whatever you want but, like others, I strongly recommend against using the system Perl. Whatever Perl versions and modules you've installed will not be deleted with an upgrade to the Mac O/S.

        Don't win a quick battle only to subsequently lose the war. :-)

        — Ken

Re^3: Establishing a beachhead and acquiring privileges on a Mac-mini
by 1nickt (Canon) on May 06, 2023 at 20:40 UTC

      Ok, well I though I was going along pretty well:

      mymac@Merrills-Mac-mini ~ % curl -L https://cpanmin.us | perl - App::c +panminus % Total % Received % Xferd Average Speed Time Time Time + Current Dload Upload Total Spent Left + Speed 100 295k 100 295k 0 0 74448 0 0:00:04 0:00:04 --:--: +-- 74554 --> Working on App::cpanminus Fetching http://www.cpan.org/authors/id/M/MI/MIYAGAWA/App-cpanminus-1. +7046.tar.gz ... OK Configuring App-cpanminus-1.7046 ... OK Building and testing App-cpanminus-1.7046 ... OK Successfully installed App-cpanminus-1.7046 1 distribution installed mymac@Merrills-Mac-mini ~ % which cpanm /Users/mymac/perl5/bin/cpanm mymac@Merrills-Mac-mini ~ %

      Then I got to bliako's suggestion:

      mymac@Merrills-Mac-mini Documents % brew analytics off mymac@Merrills-Mac-mini Documents %

      Then I start to get cpanm cranking away:

      07:55:21 mymac@Merrills-Mac-mini 1.millcreek.1 |main ✗|→ cpanm  HTML::FromText
      --> Working on HTML::FromText
      Fetching http://www.cpan.org/authors/id/R/RJ/RJBS/HTML-FromText-2.07.tar.gz ... OK
      Configuring HTML-FromText-2.07 ... OK
      ...
      07:55:54 mymac@Merrills-Mac-mini 1.millcreek.1 |main ✗|→ ./1.millcreek.1.1.pl
      Parser.c: loadable library and perl binaries are mismatched (got handshake key 0xfc00080, needed 0xc700080)
      07:55:58 mymac@Merrills-Mac-mini 1.millcreek.1 |main ✗|→ which perl
      /opt/homebrew/bin/perl
      07:57:05 mymac@Merrills-Mac-mini 1.millcreek.1 |main ✗|→ 
      

      Whoa, wipeout. Ideas?

      I wonder if the shebang needs changed from this particular script:

      #!/usr/bin/perl -w use 5.011; use lib "template_stuff"; use HTML1; use Path::Tiny; use utf8; use Encode; use open OUT => ':encoding(UTF-8)', ':std';

      Fishing for tips,

        " Ideas?"

        Wipe your Mac Mini, start from scratch, and do it right.


        The way forward always starts with a minimal test.