Install cocoapods on Big Sur(macOS11.0)

0𝕏koji
6 min readAug 22, 2020

Recently I renewed my MacBook Pro, so I needed to re-setup the dev environment.

$ sudo gem install cocoapods

Then, got the following error…

Building native extensions. This could take a while...
ERROR: Error installing cocoapods:
ERROR: Failed to build gem native extension.
current directory: /Library/Ruby/Gems/2.6.0/gems/ffi-1.13.1/ext/ffi_c
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby -I /Library/Ruby/Site/2.6.0 -r ./siteconf20200822-36226-14x8p3j.rb extconf.rb
checking for ffi_prep_closure_loc() in -lffi... no
checking for ffi_prep_closure_loc() in -llibffi... no
checking for ffi_prep_closure_loc() in -llibffi-8... no
creating extconf.h
creating Makefile
current directory: /Library/Ruby/Gems/2.6.0/gems/ffi-1.13.1/ext/ffi_c
make "DESTDIR=" clean
current directory: /Library/Ruby/Gems/2.6.0/gems/ffi-1.13.1/ext/ffi_c
make "DESTDIR="
mkdir -p "/Library/Ruby/Gems/2.6.0/gems/ffi-1.13.1/ext/ffi_c"/libffi-x86_64; (if [ ! -f "/Library/Ruby/Gems/2.6.0/gems/ffi-1.13.1/ext/ffi_c/libffi"/configure ]; then echo "Running autoreconf for libffi"; cd "/Library/Ruby/Gems/2.6.0/gems/ffi-1.13.1/ext/ffi_c/libffi" && /bin/sh /Library/Ruby/Gems/2.6.0/gems/ffi-1.13.1/ext/ffi_c/libffi/autogen.sh > /dev/null; fi); (if [ ! -f "/Library/Ruby/Gems/2.6.0/gems/ffi-1.13.1/ext/ffi_c"/libffi-x86_64/Makefile ]; then echo "Configuring libffi for x86_64"; cd "/Library/Ruby/Gems/2.6.0/gems/ffi-1.13.1/ext/ffi_c"/libffi-x86_64 && env CC=" xcrun clang" CFLAGS="-arch x86_64 " LDFLAGS="-arch x86_64" "/Library/Ruby/Gems/2.6.0/gems/ffi-1.13.1/ext/ffi_c/libffi"/configure --disable-static --with-pic=yes --disable-dependency-tracking --disable-docs --host=x86_64-apple-darwin > /dev/null; fi); /Applications/Xcode-beta.app/Contents/Developer/usr/bin/make -C "/Library/Ruby/Gems/2.6.0/gems/ffi-1.13.1/ext/ffi_c"/libffi-x86_64
Configuring libffi for x86_64
/Library/Ruby/Gems/2.6.0/gems/ffi-1.13.1/ext/ffi_c/libffi/configure: line 18632: readelf: command not found
clang: error: unsupported option '-print-multi-os-directory'
clang: error: no input files
/Applications/Xcode-beta.app/Contents/Developer/usr/bin/make all-recursive
Making all in include
make[3]: Nothing to be done for `all'.
Making all in testsuite
make[3]: Nothing to be done for `all'.
Making all in man
make[3]: Nothing to be done for `all'.
/bin/sh ./libtool --tag=CC --mode=compile xcrun clang -DHAVE_CONFIG_H -I. -I/Library/Ruby/Gems/2.6.0/gems/ffi-1.13.1/ext/ffi_c/libffi -I. -I/Library/Ruby/Gems/2.6.0/gems/ffi-1.13.1/ext/ffi_c/libffi/include -Iinclude -I/Library/Ruby/Gems/2.6.0/gems/ffi-1.13.1/ext/ffi_c/libffi/src -arch x86_64 -Wall -fexceptions -c -o src/prep_cif.lo /Library/Ruby/Gems/2.6.0/gems/ffi-1.13.1/ext/ffi_c/libffi/src/prep_cif.c
libtool: compile: xcrun clang -DHAVE_CONFIG_H -I. -I/Library/Ruby/Gems/2.6.0/gems/ffi-1.13.1/ext/ffi_c/libffi -I. -I/Library/Ruby/Gems/2.6.0/gems/ffi-1.13.1/ext/ffi_c/libffi/include -Iinclude -I/Library/Ruby/Gems/2.6.0/gems/ffi-1.13.1/ext/ffi_c/libffi/src -arch x86_64 -Wall -fexceptions -c /Library/Ruby/Gems/2.6.0/gems/ffi-1.13.1/ext/ffi_c/libffi/src/prep_cif.c -fno-common -DPIC -o src/.libs/prep_cif.o
/bin/sh ./libtool --tag=CC --mode=compile xcrun clang -DHAVE_CONFIG_H -I. -I/Library/Ruby/Gems/2.6.0/gems/ffi-1.13.1/ext/ffi_c/libffi -I. -I/Library/Ruby/Gems/2.6.0/gems/ffi-1.13.1/ext/ffi_c/libffi/include -Iinclude -I/Library/Ruby/Gems/2.6.0/gems/ffi-1.13.1/ext/ffi_c/libffi/src -arch x86_64 -Wall -fexceptions -c -o src/types.lo /Library/Ruby/Gems/2.6.0/gems/ffi-1.13.1/ext/ffi_c/libffi/src/types.c
libtool: compile: xcrun clang -DHAVE_CONFIG_H -I. -I/Library/Ruby/Gems/2.6.0/gems/ffi-1.13.1/ext/ffi_c/libffi -I. -I/Library/Ruby/Gems/2.6.0/gems/ffi-1.13.1/ext/ffi_c/libffi/include -Iinclude -I/Library/Ruby/Gems/2.6.0/gems/ffi-1.13.1/ext/ffi_c/libffi/src -arch x86_64 -Wall -fexceptions -c /Library/Ruby/Gems/2.6.0/gems/ffi-1.13.1/ext/ffi_c/libffi/src/types.c -fno-common -DPIC -o src/.libs/types.o
/bin/sh ./libtool --tag=CC --mode=compile xcrun clang -DHAVE_CONFIG_H -I. -I/Library/Ruby/Gems/2.6.0/gems/ffi-1.13.1/ext/ffi_c/libffi -I. -I/Library/Ruby/Gems/2.6.0/gems/ffi-1.13.1/ext/ffi_c/libffi/include -Iinclude -I/Library/Ruby/Gems/2.6.0/gems/ffi-1.13.1/ext/ffi_c/libffi/src -arch x86_64 -Wall -fexceptions -c -o src/raw_api.lo /Library/Ruby/Gems/2.6.0/gems/ffi-1.13.1/ext/ffi_c/libffi/src/raw_api.c
libtool: compile: xcrun clang -DHAVE_CONFIG_H -I. -I/Library/Ruby/Gems/2.6.0/gems/ffi-1.13.1/ext/ffi_c/libffi -I. -I/Library/Ruby/Gems/2.6.0/gems/ffi-1.13.1/ext/ffi_c/libffi/include -Iinclude -I/Library/Ruby/Gems/2.6.0/gems/ffi-1.13.1/ext/ffi_c/libffi/src -arch x86_64 -Wall -fexceptions -c /Library/Ruby/Gems/2.6.0/gems/ffi-1.13.1/ext/ffi_c/libffi/src/raw_api.c -fno-common -DPIC -o src/.libs/raw_api.o
/bin/sh ./libtool --tag=CC --mode=compile xcrun clang -DHAVE_CONFIG_H -I. -I/Library/Ruby/Gems/2.6.0/gems/ffi-1.13.1/ext/ffi_c/libffi -I. -I/Library/Ruby/Gems/2.6.0/gems/ffi-1.13.1/ext/ffi_c/libffi/include -Iinclude -I/Library/Ruby/Gems/2.6.0/gems/ffi-1.13.1/ext/ffi_c/libffi/src -arch x86_64 -Wall -fexceptions -c -o src/java_raw_api.lo /Library/Ruby/Gems/2.6.0/gems/ffi-1.13.1/ext/ffi_c/libffi/src/java_raw_api.c
libtool: compile: xcrun clang -DHAVE_CONFIG_H -I. -I/Library/Ruby/Gems/2.6.0/gems/ffi-1.13.1/ext/ffi_c/libffi -I. -I/Library/Ruby/Gems/2.6.0/gems/ffi-1.13.1/ext/ffi_c/libffi/include -Iinclude -I/Library/Ruby/Gems/2.6.0/gems/ffi-1.13.1/ext/ffi_c/libffi/src -arch x86_64 -Wall -fexceptions -c /Library/Ruby/Gems/2.6.0/gems/ffi-1.13.1/ext/ffi_c/libffi/src/java_raw_api.c -fno-common -DPIC -o src/.libs/java_raw_api.o
/Library/Ruby/Gems/2.6.0/gems/ffi-1.13.1/ext/ffi_c/libffi/src/java_raw_api.c:328:46: warning: 'ffi_java_raw_size' is deprecated [-Wdeprecated-declarations]
ffi_java_raw *raw = (ffi_java_raw*)alloca (ffi_java_raw_size (cif));
^
include/ffi.h:299:56: note: 'ffi_java_raw_size' has been explicitly marked deprecated here
size_t ffi_java_raw_size (ffi_cif *cif) __attribute__((deprecated));
^
/Library/Ruby/Gems/2.6.0/gems/ffi-1.13.1/ext/ffi_c/libffi/src/java_raw_api.c:331:3: warning: 'ffi_java_ptrarray_to_raw' is deprecated [-Wdeprecated-declarations]
ffi_java_ptrarray_to_raw (cif, avalue, raw);
^
include/ffi.h:295:93: note: 'ffi_java_ptrarray_to_raw' has been explicitly marked deprecated here
void ffi_java_ptrarray_to_raw (ffi_cif *cif, void **args, ffi_java_raw *raw) __attribute__((deprecated));
^
2 warnings generated.
/bin/sh ./libtool --tag=CC --mode=compile xcrun clang -DHAVE_CONFIG_H -I. -I/Library/Ruby/Gems/2.6.0/gems/ffi-1.13.1/ext/ffi_c/libffi -I. -I/Library/Ruby/Gems/2.6.0/gems/ffi-1.13.1/ext/ffi_c/libffi/include -Iinclude -I/Library/Ruby/Gems/2.6.0/gems/ffi-1.13.1/ext/ffi_c/libffi/src -arch x86_64 -Wall -fexceptions -c -o src/closures.lo /Library/Ruby/Gems/2.6.0/gems/ffi-1.13.1/ext/ffi_c/libffi/src/closures.c
libtool: compile: xcrun clang -DHAVE_CONFIG_H -I. -I/Library/Ruby/Gems/2.6.0/gems/ffi-1.13.1/ext/ffi_c/libffi -I. -I/Library/Ruby/Gems/2.6.0/gems/ffi-1.13.1/ext/ffi_c/libffi/include -Iinclude -I/Library/Ruby/Gems/2.6.0/gems/ffi-1.13.1/ext/ffi_c/libffi/src -arch x86_64 -Wall -fexceptions -c /Library/Ruby/Gems/2.6.0/gems/ffi-1.13.1/ext/ffi_c/libffi/src/closures.c -fno-common -DPIC -o src/.libs/closures.o
/bin/sh ./libtool --tag=CC --mode=compile xcrun clang -DHAVE_CONFIG_H -I. -I/Library/Ruby/Gems/2.6.0/gems/ffi-1.13.1/ext/ffi_c/libffi -I. -I/Library/Ruby/Gems/2.6.0/gems/ffi-1.13.1/ext/ffi_c/libffi/include -Iinclude -I/Library/Ruby/Gems/2.6.0/gems/ffi-1.13.1/ext/ffi_c/libffi/src -arch x86_64 -Wall -fexceptions -c -o src/x86/ffi64.lo /Library/Ruby/Gems/2.6.0/gems/ffi-1.13.1/ext/ffi_c/libffi/src/x86/ffi64.c
libtool: compile: xcrun clang -DHAVE_CONFIG_H -I. -I/Library/Ruby/Gems/2.6.0/gems/ffi-1.13.1/ext/ffi_c/libffi -I. -I/Library/Ruby/Gems/2.6.0/gems/ffi-1.13.1/ext/ffi_c/libffi/include -Iinclude -I/Library/Ruby/Gems/2.6.0/gems/ffi-1.13.1/ext/ffi_c/libffi/src -arch x86_64 -Wall -fexceptions -c /Library/Ruby/Gems/2.6.0/gems/ffi-1.13.1/ext/ffi_c/libffi/src/x86/ffi64.c -fno-common -DPIC -o src/x86/.libs/ffi64.o
/bin/sh ./libtool --mode=compile xcrun clang -DHAVE_CONFIG_H -I. -I/Library/Ruby/Gems/2.6.0/gems/ffi-1.13.1/ext/ffi_c/libffi -I. -I/Library/Ruby/Gems/2.6.0/gems/ffi-1.13.1/ext/ffi_c/libffi/include -Iinclude -I/Library/Ruby/Gems/2.6.0/gems/ffi-1.13.1/ext/ffi_c/libffi/src -I. -I/Library/Ruby/Gems/2.6.0/gems/ffi-1.13.1/ext/ffi_c/libffi/include -Iinclude -I/Library/Ruby/Gems/2.6.0/gems/ffi-1.13.1/ext/ffi_c/libffi/src -arch x86_64 -c -o src/x86/unix64.lo /Library/Ruby/Gems/2.6.0/gems/ffi-1.13.1/ext/ffi_c/libffi/src/x86/unix64.S
libtool: compile: xcrun clang -DHAVE_CONFIG_H -I. -I/Library/Ruby/Gems/2.6.0/gems/ffi-1.13.1/ext/ffi_c/libffi -I. -I/Library/Ruby/Gems/2.6.0/gems/ffi-1.13.1/ext/ffi_c/libffi/include -Iinclude -I/Library/Ruby/Gems/2.6.0/gems/ffi-1.13.1/ext/ffi_c/libffi/src -I. -I/Library/Ruby/Gems/2.6.0/gems/ffi-1.13.1/ext/ffi_c/libffi/include -Iinclude -I/Library/Ruby/Gems/2.6.0/gems/ffi-1.13.1/ext/ffi_c/libffi/src -arch x86_64 -c /Library/Ruby/Gems/2.6.0/gems/ffi-1.13.1/ext/ffi_c/libffi/src/x86/unix64.S -fno-common -DPIC -o src/x86/.libs/unix64.o
/bin/sh ./libtool --tag=CC --mode=compile xcrun clang -DHAVE_CONFIG_H -I. -I/Library/Ruby/Gems/2.6.0/gems/ffi-1.13.1/ext/ffi_c/libffi -I. -I/Library/Ruby/Gems/2.6.0/gems/ffi-1.13.1/ext/ffi_c/libffi/include -Iinclude -I/Library/Ruby/Gems/2.6.0/gems/ffi-1.13.1/ext/ffi_c/libffi/src -arch x86_64 -Wall -fexceptions -c -o src/x86/ffiw64.lo /Library/Ruby/Gems/2.6.0/gems/ffi-1.13.1/ext/ffi_c/libffi/src/x86/ffiw64.c
libtool: compile: xcrun clang -DHAVE_CONFIG_H -I. -I/Library/Ruby/Gems/2.6.0/gems/ffi-1.13.1/ext/ffi_c/libffi -I. -I/Library/Ruby/Gems/2.6.0/gems/ffi-1.13.1/ext/ffi_c/libffi/include -Iinclude -I/Library/Ruby/Gems/2.6.0/gems/ffi-1.13.1/ext/ffi_c/libffi/src -arch x86_64 -Wall -fexceptions -c /Library/Ruby/Gems/2.6.0/gems/ffi-1.13.1/ext/ffi_c/libffi/src/x86/ffiw64.c -fno-common -DPIC -o src/x86/.libs/ffiw64.o
/bin/sh ./libtool --mode=compile xcrun clang -DHAVE_CONFIG_H -I. -I/Library/Ruby/Gems/2.6.0/gems/ffi-1.13.1/ext/ffi_c/libffi -I. -I/Library/Ruby/Gems/2.6.0/gems/ffi-1.13.1/ext/ffi_c/libffi/include -Iinclude -I/Library/Ruby/Gems/2.6.0/gems/ffi-1.13.1/ext/ffi_c/libffi/src -I. -I/Library/Ruby/Gems/2.6.0/gems/ffi-1.13.1/ext/ffi_c/libffi/include -Iinclude -I/Library/Ruby/Gems/2.6.0/gems/ffi-1.13.1/ext/ffi_c/libffi/src -arch x86_64 -c -o src/x86/win64.lo /Library/Ruby/Gems/2.6.0/gems/ffi-1.13.1/ext/ffi_c/libffi/src/x86/win64.S
libtool: compile: xcrun clang -DHAVE_CONFIG_H -I. -I/Library/Ruby/Gems/2.6.0/gems/ffi-1.13.1/ext/ffi_c/libffi -I. -I/Library/Ruby/Gems/2.6.0/gems/ffi-1.13.1/ext/ffi_c/libffi/include -Iinclude -I/Library/Ruby/Gems/2.6.0/gems/ffi-1.13.1/ext/ffi_c/libffi/src -I. -I/Library/Ruby/Gems/2.6.0/gems/ffi-1.13.1/ext/ffi_c/libffi/include -Iinclude -I/Library/Ruby/Gems/2.6.0/gems/ffi-1.13.1/ext/ffi_c/libffi/src -arch x86_64 -c /Library/Ruby/Gems/2.6.0/gems/ffi-1.13.1/ext/ffi_c/libffi/src/x86/win64.S -fno-common -DPIC -o src/x86/.libs/win64.o
/bin/sh ./libtool --tag=CC --mode=link xcrun clang -arch x86_64 -Wall -fexceptions -arch x86_64 -o libffi_convenience.la src/prep_cif.lo src/types.lo src/raw_api.lo src/java_raw_api.lo src/closures.lo src/x86/ffi64.lo src/x86/unix64.lo src/x86/ffiw64.lo src/x86/win64.lo
libtool: link: ar cru .libs/libffi_convenience.a src/.libs/prep_cif.o src/.libs/types.o src/.libs/raw_api.o src/.libs/java_raw_api.o src/.libs/closures.o src/x86/.libs/ffi64.o src/x86/.libs/unix64.o src/x86/.libs/ffiw64.o src/x86/.libs/win64.o
libtool: link: ranlib .libs/libffi_convenience.a
libtool: link: ( cd ".libs" && rm -f "libffi_convenience.la" && ln -s "../libffi_convenience.la" "libffi_convenience.la" )
/bin/sh ./libtool --tag=CC --mode=link xcrun clang -arch x86_64 -Wall -fexceptions -no-undefined -version-info `grep -v '^#' /Library/Ruby/Gems/2.6.0/gems/ffi-1.13.1/ext/ffi_c/libffi/libtool-version` '-arch' 'x86_64' -arch x86_64 -o libffi.la -rpath /usr/local/lib src/prep_cif.lo src/types.lo src/raw_api.lo src/java_raw_api.lo src/closures.lo src/x86/ffi64.lo src/x86/unix64.lo src/x86/ffiw64.lo src/x86/win64.lo
libtool: link: xcrun clang -dynamiclib -o .libs/libffi.8.dylib src/.libs/prep_cif.o src/.libs/types.o src/.libs/raw_api.o src/.libs/java_raw_api.o src/.libs/closures.o src/x86/.libs/ffi64.o src/x86/.libs/unix64.o src/x86/.libs/ffiw64.o src/x86/.libs/win64.o -arch x86_64 -arch x86_64 -arch x86_64 -install_name /usr/local/lib/libffi.8.dylib -compatibility_version 10 -current_version 10.0 -Wl,-single_module
libtool: link: (cd ".libs" && rm -f "libffi.dylib" && ln -s "libffi.8.dylib" "libffi.dylib")
libtool: link: ( cd ".libs" && rm -f "libffi.la" && ln -s "../libffi.la" "libffi.la" )
# Assemble into a FAT (x86_64, i386, ppc) library
/usr/bin/libtool -static -o "/Library/Ruby/Gems/2.6.0/gems/ffi-1.13.1/ext/ffi_c/libffi-universal-darwin20"/.libs/libffi_convenience.a \
"/Library/Ruby/Gems/2.6.0/gems/ffi-1.13.1/ext/ffi_c"/libffi-x86_64/.libs/libffi_convenience.a
rm -f "/Library/Ruby/Gems/2.6.0/gems/ffi-1.13.1/ext/ffi_c/libffi-universal-darwin20"/include/ffi.h
compiling AbstractMemory.c
In file included from AbstractMemory.c:47:
In file included from ./AbstractMemory.h:42:
In file included from ./Types.h:79:
./Type.h:50:5: error: unknown type name 'ffi_type'
ffi_type* ffiType;
^
In file included from AbstractMemory.c:49:
In file included from ./Function.h:48:
./Call.h:93:5: error: unknown type name 'ffi_cif'
ffi_cif cif;
^
In file included from AbstractMemory.c:49:
./Function.h:59:5: error: unknown type name 'ffi_type'
ffi_type* ffiReturnType;
^
./Function.h:60:5: error: unknown type name 'ffi_type'
ffi_type** ffiParameterTypes;
^
./Function.h:61:5: error: unknown type name 'ffi_cif'
ffi_cif ffi_cif;
^
./Function.h:66:5: error: unknown type name 'ffi_abi'
ffi_abi abi;
^
6 errors generated.
make: *** [AbstractMemory.o] Error 1
make failed, exit code 2Gem files will remain installed in /Library/Ruby/Gems/2.6.0/gems/ffi-1.13.1 for inspection.
Results logged to /Library/Ruby/Gems/2.6.0/extensions/universal-darwin-20/2.6.0/ffi-1.13.1/gem_make.out
$ sudo xcode-select --install

Then got another error…

Can’t install the software because it is not currently available from the Software Update server.

I installed the Command Line Tool manually. (Need Apple dev ID)

After installing the Command Line Tool, tried to install cocoapods again and got a new error… 😅

Building native extensions. This could take a while...
Successfully installed ffi-1.13.1
Successfully installed ethon-0.12.0
Successfully installed typhoeus-1.4.0
Successfully installed netrc-0.11.0
Successfully installed cocoapods-core-1.9.3
Successfully installed claide-1.0.3
Successfully installed cocoapods-deintegrate-1.0.4
Successfully installed cocoapods-downloader-1.4.0
Successfully installed cocoapods-plugins-1.0.0
Successfully installed cocoapods-search-1.0.0
Successfully installed cocoapods-stats-1.1.0
Successfully installed cocoapods-trunk-1.5.0
Successfully installed cocoapods-try-1.2.0
Successfully installed molinillo-0.6.6
Successfully installed atomos-0.1.3
Successfully installed colored2-3.1.2
Successfully installed nanaimo-0.3.0
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /usr/bin directory.
$ sudo gem install -n /usr/local/bin cocoapods
Successfully installed xcodeproj-1.18.0
Successfully installed escape-0.0.4
Successfully installed fourflusher-2.3.1
Successfully installed gh_inspector-1.1.3
Successfully installed ruby-macho-1.4.0
Successfully installed cocoapods-1.9.3
Parsing documentation for xcodeproj-1.18.0
Installing ri documentation for xcodeproj-1.18.0
Parsing documentation for escape-0.0.4
Installing ri documentation for escape-0.0.4
Parsing documentation for fourflusher-2.3.1
Installing ri documentation for fourflusher-2.3.1
Parsing documentation for gh_inspector-1.1.3
Installing ri documentation for gh_inspector-1.1.3
Parsing documentation for ruby-macho-1.4.0
Installing ri documentation for ruby-macho-1.4.0
Parsing documentation for cocoapods-1.9.3
Installing ri documentation for cocoapods-1.9.3
Done installing documentation for xcodeproj, escape, fourflusher, gh_inspector, ruby-macho, cocoapods after 3 seconds
6 gems installed

Finally, I could install cocoapods successfully ✌️

--

--

0𝕏koji

software engineer works for a Biotechnology Research startup in Brooklyn. #CreativeCoding #Art #IoT #MachineLearning #python #typescript #javascript #reactjs