Last active
December 17, 2023 10:14
-
-
Save LiosK/acef3b100a7096f8f9c7b0d1c98cf9c8 to your computer and use it in GitHub Desktop.
Install Perl modules in macOS system Perl without cluttering /usr/local
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -x | |
# Install Perl modules in macOS system Perl without cluttering /usr/local | |
# Prerequisite | |
xcode-select --install | |
# Install modules locally, instructing cpanm to build Universal Binaries | |
sysperl=/usr/bin/perl | |
curl -L https://cpanmin.us/ | \ | |
ARCHFLAGS='-arch arm64 -arch arm64e -arch x86_64' \ | |
$sysperl - -n --local-lib=~/.sys_perl5 \ | |
JSON::Parse https://github.com/LiosK/Finance--Quote--YahooJapan.git | |
# NOTE: persist these env vars to have sysperl and FQ load local libs and YahooJapan | |
export PERL5LIB="$HOME/.sys_perl5/lib/perl5" | |
export FQ_LOAD_QUOTELET='-defaults YahooJapan' | |
# Test | |
$sysperl -e 'print "$_\n" for @INC;' | |
$sysperl ~/.sys_perl5/bin/fetch_quotes_from_yahoo_japan.pl |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Motivations:
cpan --sudo module_name
puts some script and document files under /usr/local, which conflict with Homebrew Perl