The Perl on MacOS Sonoma
Is it necessary to install Linux OS on MacOS Sonoma (A virtualization on MacMini) when I would consider to run Perl script?
Could somebody resolve this definitely, pls.
Mac mini, macOS 14.7
Is it necessary to install Linux OS on MacOS Sonoma (A virtualization on MacMini) when I would consider to run Perl script?
Could somebody resolve this definitely, pls.
Mac mini, macOS 14.7
Apple continues to include /usr/bin/perl in the macOS installation. Sequoia v15.2 and Sonoma v14.7.2 have Perl v5.34.1. Although as far back as macOS Catalina, Apple had indicated that they would vanquish Python, Ruby, and Perl, they have only removed Python from macOS installations.
If you plan to add additional Perl modules, a newer version of Perl 5, or Raku/Rakudō (Perl 6), then you will need to incorporate a Perl version manager. I happen to stay current with Ruby and thus use the asdf version manager. It supports Ruby, Perl, and many other language plugins. Then you can install and maintain the language version using asdf and switch between your version and the System Perl.
I installed asdf via homebrew:
# homebrew requires the Apple Command Line tools and will install them as part of its installation
brew info asdf
brew deps --tree --installed asdf
brew install asdf
Now you can install the Perl plugin for asdf:
# perl or raku
asdf plugin add perl
asdf plugin list
# all non-Raku Perl versions (Requires Perl plug-in installed)
asdf list-all perl | more
# install latest or specific Perl version
asdf install perl latest
# make this Perl active not the System Perl
asdf global perl latest
asdf current
asdf info
perl --version
Apple continues to include /usr/bin/perl in the macOS installation. Sequoia v15.2 and Sonoma v14.7.2 have Perl v5.34.1. Although as far back as macOS Catalina, Apple had indicated that they would vanquish Python, Ruby, and Perl, they have only removed Python from macOS installations.
If you plan to add additional Perl modules, a newer version of Perl 5, or Raku/Rakudō (Perl 6), then you will need to incorporate a Perl version manager. I happen to stay current with Ruby and thus use the asdf version manager. It supports Ruby, Perl, and many other language plugins. Then you can install and maintain the language version using asdf and switch between your version and the System Perl.
I installed asdf via homebrew:
# homebrew requires the Apple Command Line tools and will install them as part of its installation
brew info asdf
brew deps --tree --installed asdf
brew install asdf
Now you can install the Perl plugin for asdf:
# perl or raku
asdf plugin add perl
asdf plugin list
# all non-Raku Perl versions (Requires Perl plug-in installed)
asdf list-all perl | more
# install latest or specific Perl version
asdf install perl latest
# make this Perl active not the System Perl
asdf global perl latest
asdf current
asdf info
perl --version
NOTE: It is possible to install a virtual machine and run Linux, however, assuming you have an Apple Silicon Mac (M1, M2, M3, M4, ...), then you should find an ARM64 (Aarch64) version of Linux to run in the virtual machine.
UTM (https://getutm.app) free
VMware Fusion has a free for personal use license
VirtualBox latest release will run an ARM64 (Aarch64) version of Linux
Parallels (paid app), but is the most popular and full featured virtual machine.
But to run Perl, you do not need Linux, and using Homebrew, you can install most of the open source utilities you would normally find on a Linux system, including the most recent version of Perl 5.38.2_1, and get cpan libraries.
/usr/bin/perl -V
Summary of my perl5 (revision 5 version 34 subversion 1) configuration:
Platform:
osname=darwin
osvers=24.0
archname=darwin-thread-multi-2level
uname='darwin 5dgj7.p1s.plx.sd.apple.com 24.0 darwin kernel version 22.1.0: thu dec 15 17:42:24 pst 2022; root:xnu-8792.41.9.100.2~1development_x86_64 x86_64 '
config_args='-ds -e -Dprefix=/usr -Dccflags=-g -pipe -Dldflags= -Dman3ext=3pm -Duseithreads -Duseshrplib -Dinc_version_list=none -Dcc=cc'
hint=recommended
useposix=true
d_sigaction=define
useithreads=define
usemultiplicity=define
use64bitint=define
use64bitall=define
uselongdouble=undef
usemymalloc=n
default_inc_excludes_dot=define
Compiler:
cc='cc'
ccflags =' -g -pipe -DPERL_USE_SAFE_PUTENV'
optimize='-Os'
cppflags='-g -pipe'
ccversion=''
gccversion='Apple LLVM 16.0.0 (clang-1600.0.25.3) [+internal-os]'
gccosandvers=''
intsize=4
longsize=8
ptrsize=8
doublesize=8
byteorder=12345678
doublekind=3
d_longlong=define
longlongsize=8
d_longdbl=define
longdblsize=16
longdblkind=3
ivtype='long'
ivsize=8
nvtype='double'
nvsize=8
Off_t='off_t'
lseeksize=8
alignbytes=8
prototype=define
Linker and Libraries:
ld='cc'
ldflags =' '
libpth=/AppleInternal/Library/BuildRoots/4b66fb3c-7dd0-11ef-b4fb-4a83e32a47e1/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.1.Internal.sdk/usr/local/lib /AppleInternal/Library/BuildRoots/4b66fb3c-7dd0-11ef-b4fb-4a83e32a47e1/Applications/Xcode.app/Contents/Developer/Toolchains/OSX15.1.xctoolchain/usr/lib/clang/16/lib /AppleInternal/Library/BuildRoots/4b66fb3c-7dd0-11ef-b4fb-4a83e32a47e1/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.1.Internal.sdk/usr/lib /AppleInternal/Library/BuildRoots/4b66fb3c-7dd0-11ef-b4fb-4a83e32a47e1/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib /usr/lib /usr/local/lib
libs=
perllibs=
libc=
so=dylib
useshrplib=true
libperl=libperl.dylib
gnulibc_version=''
Dynamic Linking:
dlsrc=dl_dlopen.xs
dlext=bundle
d_dlsymun=undef
ccdlflags=' '
cccdlflags=' '
lddlflags=' -bundle -undefined dynamic_lookup'
Characteristics of this binary (from libperl):
Compile-time options:
HAS_TIMES
MULTIPLICITY
PERLIO_LAYERS
PERL_COPY_ON_WRITE
PERL_DONT_CREATE_GVSV
PERL_IMPLICIT_CONTEXT
PERL_MALLOC_WRAP
PERL_OP_PARENT
PERL_PRESERVE_IVUV
PERL_USE_SAFE_PUTENV
USE_64_BIT_ALL
USE_64_BIT_INT
USE_ITHREADS
USE_LARGE_FILES
USE_LOCALE
USE_LOCALE_COLLATE
USE_LOCALE_CTYPE
USE_LOCALE_NUMERIC
USE_LOCALE_TIME
USE_PERLIO
USE_PERL_ATOF
USE_REENTRANT_API
USE_THREAD_SAFE_LOCALE
Locally applied patches:
/Library/Perl/Updates/<version> comes before system perl directories
installprivlib and installarchlib points to the Updates directory
Built under darwin
Compiled at Sep 28 2024 16:20:11
@INC:
/Library/Perl/5.34/darwin-thread-multi-2level
/Library/Perl/5.34
/Network/Library/Perl/5.34/darwin-thread-multi-2level
/Network/Library/Perl/5.34
/Library/Perl/Updates/5.34.1
/System/Library/Perl/5.34/darwin-thread-multi-2level
/System/Library/Perl/5.34
/System/Library/Perl/Extras/5.34/darwin-thread-multi-2level
/System/Library/Perl/Extras/5.34
There is a version of Perl installed on macOS. I use it frequently.
If you need a newer version or you need a Perl module not currently on macOS, you could use Homebrew to install what you need
The Perl on MacOS Sonoma