macOSにてPerlモジュールをインストールする時に、Mac::SystemDirectory failed. が出てインストールが進まない時に試すことです。
環境
- macOS 10.13.6
- plenv 2.2.0
- Homebrew 2.2.2
- perl 5.30.1
- Xcode 6
エラー
cpanm で Minilla をインストールした際に ! Installing Mac::SystemDirectory failed.
と表示された。
$ cpanm -n --with-recommends Minilla
--> Working on Minilla
Fetching http://www.cpan.org/authors/id/S/SK/SKAJI/Minilla-v3.1.8.tar.gz ... OK
Configuring Minilla-v3.1.8 ... OK
==> Found dependencies: Config::Identity, Test::PAUSE::Permissions, CPAN::Uploader
--> Working on Config::Identity
Fetching http://www.cpan.org/authors/id/D/DA/DAGOLDEN/Config-Identity-0.0019.tar.gz ... OK
Configuring Config-Identity-0.0019 ... OK
==> Found dependencies: File::HomeDir
--> Working on File::HomeDir
Fetching http://www.cpan.org/authors/id/R/RE/REHSACK/File-HomeDir-1.004.tar.gz ... OK
Configuring File-HomeDir-1.004 ... OK
==> Found dependencies: Mac::SystemDirectory
--> Working on Mac::SystemDirectory
Fetching http://www.cpan.org/authors/id/E/ET/ETHER/Mac-SystemDirectory-0.13.tar.gz ... OK
Configuring Mac-SystemDirectory-0.13 ... OK
Building Mac-SystemDirectory-0.13 ... FAIL
! Installing Mac::SystemDirectory failed. See /Users/kazoo/.cpanm/work/1578018382.29439/build.log for details. Retry with --force to force install it.
! Installing the dependencies failed: Module 'Mac::SystemDirectory' is not installed
! Bailing out the installation for File-HomeDir-1.004.
! Installing the dependencies failed: Module 'File::HomeDir' is not installed
! Bailing out the installation for Config-Identity-0.0019.
--> Working on Test::PAUSE::Permissions
Fetching http://www.cpan.org/authors/id/S/SK/SKAJI/Test-PAUSE-Permissions-0.07.tar.gz ... OK
Configuring Test-PAUSE-Permissions-0.07 ... OK
==> Found dependencies: PAUSE::Permissions, Config::Identity
--> Working on PAUSE::Permissions
Fetching http://www.cpan.org/authors/id/N/NE/NEILB/PAUSE-Permissions-0.17.tar.gz ... OK
Configuring PAUSE-Permissions-0.17 ... OK
==> Found dependencies: File::HomeDir
! Installing the dependencies failed: Module 'File::HomeDir' is not installed
! Bailing out the installation for PAUSE-Permissions-0.17.
! Installing the dependencies failed: Module 'Config::Identity' is not installed, Module 'PAUSE::Permissions' is not installed
! Bailing out the installation for Test-PAUSE-Permissions-0.07.
--> Working on CPAN::Uploader
Fetching http://www.cpan.org/authors/id/R/RJ/RJBS/CPAN-Uploader-0.103013.tar.gz ... OK
Configuring CPAN-Uploader-0.103013 ... OK
==> Found dependencies: File::HomeDir
! Installing the dependencies failed: Module 'File::HomeDir' is not installed
! Bailing out the installation for CPAN-Uploader-0.103013.
! Installing the dependencies failed: Module 'Config::Identity' is not installed
! Bailing out the installation for Minilla-v3.1.8.
Mac::SystemDirectory を --force でインストール
Mac::SystemDirectory モジュールを単体でインストールしても失敗する。
$ cpanm --force Mac::SystemDirectory
--> Working on Mac::SystemDirectory
Fetching http://www.cpan.org/authors/id/E/ET/ETHER/Mac-SystemDirectory-0.13.tar.gz ... OK
Configuring Mac-SystemDirectory-0.13 ... OK
Building and testing Mac-SystemDirectory-0.13 ... FAIL
! Installing Mac::SystemDirectory failed.
原因
Xcodeを更新していないのが原因っぽいので、現在のOSのバージョンに合った最新版を探してインストール。
Xcodeを更新
https://developer.apple.com/download/more/
この辺りからXcodeをダウンロードしてきて、インストールする。
いくつか試してみてOSのバージョンでインストール可能な一番新しいXcodeをインストール。
今回は Xcode 9.4.1 をインストールした。
Mac::SystemDirectory をインストール
$ cpanm --force Mac::SystemDirectory
--> Working on Mac::SystemDirectory
Fetching http://www.cpan.org/authors/id/E/ET/ETHER/Mac-SystemDirectory-0.13.tar.gz ... OK
Configuring Mac-SystemDirectory-0.13 ... OK
Building and testing Mac-SystemDirectory-0.13 ... OK
Successfully installed Mac-SystemDirectory-0.13
1 distribution installed
Mimillaもインストール
$ cpanm -n --with-recommends Minilla
--> Working on Minilla
Fetching http://www.cpan.org/authors/id/S/SK/SKAJI/Minilla-v3.1.8.tar.gz ... OK
Configuring Minilla-v3.1.8 ... OK
==> Found dependencies: Config::Identity, CPAN::Uploader, Test::PAUSE::Permissions
--> Working on Config::Identity
Fetching http://www.cpan.org/authors/id/D/DA/DAGOLDEN/Config-Identity-0.0019.tar.gz ... OK
Configuring Config-Identity-0.0019 ... OK
==> Found dependencies: File::HomeDir
--> Working on File::HomeDir
Fetching http://www.cpan.org/authors/id/R/RE/REHSACK/File-HomeDir-1.004.tar.gz ... OK
Configuring File-HomeDir-1.004 ... OK
Building File-HomeDir-1.004 ... OK
Successfully installed File-HomeDir-1.004
Building Config-Identity-0.0019 ... OK
Successfully installed Config-Identity-0.0019
--> Working on CPAN::Uploader
Fetching http://www.cpan.org/authors/id/R/RJ/RJBS/CPAN-Uploader-0.103013.tar.gz ... OK
Configuring CPAN-Uploader-0.103013 ... OK
Building CPAN-Uploader-0.103013 ... OK
Successfully installed CPAN-Uploader-0.103013
--> Working on Test::PAUSE::Permissions
Fetching http://www.cpan.org/authors/id/S/SK/SKAJI/Test-PAUSE-Permissions-0.07.tar.gz ... OK
Configuring Test-PAUSE-Permissions-0.07 ... OK
==> Found dependencies: PAUSE::Permissions
--> Working on PAUSE::Permissions
Fetching http://www.cpan.org/authors/id/N/NE/NEILB/PAUSE-Permissions-0.17.tar.gz ... OK
Configuring PAUSE-Permissions-0.17 ... OK
Building PAUSE-Permissions-0.17 ... OK
Successfully installed PAUSE-Permissions-0.17
Building Test-PAUSE-Permissions-0.07 ... OK
Successfully installed Test-PAUSE-Permissions-0.07
Building Minilla-v3.1.8 ... OK
Successfully installed Minilla-v3.1.8
6 distributions installed
$ plenv rehash
$ minil --version
Minilla: v3.1.8
参考
- [LaTeX] [Mojave] Mac で latexindent が上手く動作しないときの対処法
- Failed to install on OSX Mojave Mac::SystemDirectory is not installed. #39
- https://gist.github.com/jhannah/ebcebe2a55530b67e0de
あとがき
Xcodeなどは開発に必要なヘッダーやライブラリを含むので、アップデートすること。
See build.log
$ cat /Users/kazoo/.cpanm/work/1578022716.30125/build.log
cpanm (App::cpanminus) 1.7044 on perl 5.030001 built for darwin-2level
Work directory is /Users/kazoo/.cpanm/work/1578022716.30125
You have make /usr/bin/make
You have LWP 6.43
You have /usr/bin/tar: bsdtar 2.8.3 - libarchive 2.8.3
You have /usr/bin/unzip
Searching Mac::SystemDirectory () on cpanmetadb ...
--> Working on Mac::SystemDirectory
Fetching http://www.cpan.org/authors/id/E/ET/ETHER/Mac-SystemDirectory-0.13.tar.gz
-> OK
Unpacking Mac-SystemDirectory-0.13.tar.gz
Entering Mac-SystemDirectory-0.13
Checking configure dependencies from META.json
Checking if you have ExtUtils::MakeMaker 6.58 ... Yes (7.34)
Configuring Mac-SystemDirectory-0.13
Running Makefile.PL
Checking if your kit is complete...
Looks good
Generating a Unix-style Makefile
Writing Makefile for Mac::SystemDirectory
Writing MYMETA.yml and MYMETA.json
-> OK
Checking dependencies from MYMETA.json ...
Checking if you have Exporter 0 ... Yes (5.73)
Checking if you have XSLoader 0 ... Yes (0.30)
Checking if you have Test::More 0 ... Yes (1.302162)
Checking if you have File::Spec 0 ... Yes (3.78)
Checking if you have warnings 0 ... Yes (1.44)
Checking if you have strict 0 ... Yes (1.11)
Checking if you have ExtUtils::MakeMaker 0 ... Yes (7.34)
Building and testing Mac-SystemDirectory-0.13
cp lib/Mac/SystemDirectory.pm blib/lib/Mac/SystemDirectory.pm
Running Mkbootstrap for SystemDirectory ()
chmod 644 "SystemDirectory.bs"
"/Users/kazoo/.plenv/versions/5.30.1/bin/perl5.30.1" -MExtUtils::Command::MM -e 'cp_nonempty' -- SystemDirectory.bs blib/arch/auto/Mac/SystemDirectory/SystemDirectory.bs 644
"/Users/kazoo/.plenv/versions/5.30.1/bin/perl5.30.1" "/Users/kazoo/.plenv/versions/5.30.1/lib/perl5/5.30.1/ExtUtils/xsubpp" -typemap '/Users/kazoo/.plenv/versions/5.30.1/lib/perl5/5.30.1/ExtUtils/typemap' SystemDirectory.xs > SystemDirectory.xsc
mv SystemDirectory.xsc SystemDirectory.c
mv SystemDirectory.c SystemDirectory.m
cc -c -fno-common -DPERL_DARWIN -mmacosx-version-min=10.13 -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -DPERL_USE_SAFE_PUTENV -O3 -DVERSION=\"0.13\" -DXS_VERSION=\"0.13\" "-I/Users/kazoo/.plenv/versions/5.30.1/lib/perl5/5.30.1/darwin-2level/CORE" -DHAS_BOOL SystemDirectory.m
SystemDirectory.xs:8:8: warning: extra tokens at end of #endif directive [-Wextra-tokens]
# endif Move
^
//
SystemDirectory.xs:12:8: warning: extra tokens at end of #endif directive [-Wextra-tokens]
# endif I_POLL
^
//
In file included from SystemDirectory.xs:14:
In file included from /System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:10:
In file included from /System/Library/Frameworks/Foundation.framework/Headers/NSArray.h:5:
/System/Library/Frameworks/Foundation.framework/Headers/NSObject.h:19:21: error: expected a type
- (id)copyWithZone:(nullable NSZone *)zone;
^
/System/Library/Frameworks/Foundation.framework/Headers/NSObject.h:25:28: error: expected a type
- (id)mutableCopyWithZone:(nullable NSZone *)zone;
^
/System/Library/Frameworks/Foundation.framework/Headers/NSObject.h:32:4: error: expected a type
- (nullable instancetype)initWithCoder:(NSCoder *)aDecoder; // NS_DESIGNATED_INITIALIZER
^
/System/Library/Frameworks/Foundation.framework/Headers/NSObject.h:43:12: error: unknown property attribute 'class'
@property (class, readonly) BOOL supportsSecureCoding;
^
/System/Library/Frameworks/Foundation.framework/Headers/NSObject.h:53:4: error: expected a type
- (nullable id)replacementObjectForCoder:(NSCoder *)aCoder;
^
/System/Library/Frameworks/Foundation.framework/Headers/NSObject.h:54:4: error: expected a type
- (nullable id)awakeAfterUsingCoder:(NSCoder *)aDecoder NS_REPLACES_RECEIVER;
^
In file included from SystemDirectory.xs:14:
In file included from /System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:10:
In file included from /System/Library/Frameworks/Foundation.framework/Headers/NSArray.h:6:
/System/Library/Frameworks/Foundation.framework/Headers/NSEnumerator.h:7:15: error: expected ';' after @class
@class NSArray<ObjectType>;
^
/System/Library/Frameworks/Foundation.framework/Headers/NSEnumerator.h:7:16: error: cannot find protocol declaration for 'ObjectType'
@class NSArray<ObjectType>;
^
/System/Library/Frameworks/Foundation.framework/Headers/NSEnumerator.h:34:25: error: cannot find protocol declaration for 'ObjectType'
@interface NSEnumerator<ObjectType> : NSObject <NSFastEnumeration>
^
/System/Library/Frameworks/Foundation.framework/Headers/NSEnumerator.h:34:37: error: expected identifier or '('
@interface NSEnumerator<ObjectType> : NSObject <NSFastEnumeration>
^
/System/Library/Frameworks/Foundation.framework/Headers/NSEnumerator.h:36:4: error: expected a type
- (nullable ObjectType)nextObject;
^
/System/Library/Frameworks/Foundation.framework/Headers/NSEnumerator.h:40:25: error: cannot find protocol declaration for 'ObjectType'
@interface NSEnumerator<ObjectType> (NSExtendedEnumerator)
^
/System/Library/Frameworks/Foundation.framework/Headers/NSEnumerator.h:40:1: error: duplicate interface definition for class 'NSEnumerator'
@interface NSEnumerator<ObjectType> (NSExtendedEnumerator)
^
/System/Library/Frameworks/Foundation.framework/Headers/NSEnumerator.h:34:12: note: previous definition is here
@interface NSEnumerator<ObjectType> : NSObject <NSFastEnumeration>
^
/System/Library/Frameworks/Foundation.framework/Headers/NSEnumerator.h:40:37: error: method type specifier must start with '-' or '+'
@interface NSEnumerator<ObjectType> (NSExtendedEnumerator)
^
/System/Library/Frameworks/Foundation.framework/Headers/NSEnumerator.h:40:38: error: expected a type
@interface NSEnumerator<ObjectType> (NSExtendedEnumerator)
^
/System/Library/Frameworks/Foundation.framework/Headers/NSEnumerator.h:42:1: error: expected selector for Objective-C method
@property (readonly, copy) NSArray<ObjectType> *allObjects;
^
/System/Library/Frameworks/Foundation.framework/Headers/NSEnumerator.h:42:28: error: unknown type name 'NSArray'
@property (readonly, copy) NSArray<ObjectType> *allObjects;
^
/System/Library/Frameworks/Foundation.framework/Headers/NSEnumerator.h:42:35: error: expected member name or ';' after declaration specifiers
@property (readonly, copy) NSArray<ObjectType> *allObjects;
~~~~~~~^
/System/Library/Frameworks/Foundation.framework/Headers/NSEnumerator.h:42:1: error: property requires fields to be named
@property (readonly, copy) NSArray<ObjectType> *allObjects;
^ ~~~~~~~
fatal error: too many errors emitted, stopping now [-ferror-limit=]
2 warnings and 20 errors generated.
make: *** [SystemDirectory.o] Error 1
-> FAIL Installing Mac::SystemDirectory failed. See /Users/kazoo/.cpanm/work/1578022716.30125/build.log for details. Retry with --force to force install it.