CocoaPods 安装

 

1. 更新了系统,发现 $ sudo gem install cocoapods 安装报错。

 

$ sudo gem install cocoapods
Password:
Building native extensions. This could take a while...
/Users/WeepYan/.rvm/rubies/ruby-2.6.0/lib/ruby/2.6.0/rubygems/ext/builder.rb:76: warning: Insecure world writable dir /usr/local/mysql in PATH, mode 040777
ERROR:  Error installing cocoapods:
    ERROR: Failed to build gem native extension.

    current directory: /Users/WeepYan/.rvm/rubies/ruby-2.6.0/lib/ruby/gems/2.6.0/gems/ffi-1.13.1/ext/ffi_c
/Users/WeepYan/.rvm/rubies/ruby-2.6.0/bin/ruby -I /Users/WeepYan/.rvm/rubies/ruby-2.6.0/lib/ruby/2.6.0 -r ./siteconf20201208-3504-1o2g6p3.rb extconf.rb
/Users/WeepYan/.rvm/rubies/ruby-2.6.0/lib/ruby/2.6.0/mkmf.rb:1565: warning: Insecure world writable dir /usr/local/mysql in PATH, mode 040777
checking for ffi.h... no
checking for ffi.h in /usr/local/include,/usr/include/ffi,/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/ffi,/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/ffi... yes
checking for ffi_prep_closure_loc() in -lffi... yes
checking for ffi_prep_cif_var()... yes
checking for ffi_raw_call()... yes
checking for ffi_prep_raw_closure()... yes
creating extconf.h
creating Makefile

current directory: /Users/WeepYan/.rvm/rubies/ruby-2.6.0/lib/ruby/gems/2.6.0/gems/ffi-1.13.1/ext/ffi_c
make "DESTDIR=" clean

current directory: /Users/WeepYan/.rvm/rubies/ruby-2.6.0/lib/ruby/gems/2.6.0/gems/ffi-1.13.1/ext/ffi_c
make "DESTDIR="
compiling AbstractMemory.c
compiling ArrayType.c
compiling Buffer.c
compiling Call.c
compiling ClosurePool.c
compiling DynamicLibrary.c
compiling Function.c
compiling FunctionInfo.c
compiling LastError.c
compiling LongDouble.c
compiling MappedType.c
compiling MemoryPointer.c
compiling MethodHandle.c
compiling Platform.c
compiling Pointer.c
compiling Struct.c
compiling StructByValue.c
compiling StructLayout.c
compiling Thread.c
compiling Type.c
compiling Types.c
compiling Variadic.c
compiling ffi.c
linking shared-object ffi_c.bundle
ld: warning: directory not found for option '-L/usr/local/opt/libksba/lib'
ld: warning: directory not found for option '-L/usr/local/opt/libksba/lib'
ld: warning: directory not found for option '-L/usr/local/opt/libksba/lib'

current directory: /Users/WeepYan/.rvm/rubies/ruby-2.6.0/lib/ruby/gems/2.6.0/gems/ffi-1.13.1/ext/ffi_c
make "DESTDIR=" install
make: /usr/local/opt/coreutils/bin/gmkdir: No such file or directory
make: *** [.sitearchdir.time] Error 1

make install failed, exit code 2

Gem files will remain installed in /Users/WeepYan/.rvm/rubies/ruby-2.6.0/lib/ruby/gems/2.6.0/gems/ffi-1.13.1 for inspection.
Results logged to /Users/WeepYan/.rvm/rubies/ruby-2.6.0/lib/ruby/gems/2.6.0/extensions/x86_64-darwin-17/2.6.0/ffi-1.13.1/gem_make.out

 

2. 安装 coreutils即可 $ brew install coreutils 

 

$ brew install coreutils
Updating Homebrew...
==> Downloading https://homebrew.bintray.com/bottles/coreutils-8.32.catalina.bot
==> Downloading from https://d29vzk4ow07wi7.cloudfront.net/f40ba727ec1bb54300c7c
######################################################################## 100.0%
==> Pouring coreutils-8.32.catalina.bottle.1.tar.gz
==> Caveats
Commands also provided by macOS have been installed with the prefix "g".
If you need to use these commands with their normal names, you
can add a "gnubin" directory to your PATH from your bashrc like:
  PATH="/usr/local/opt/coreutils/libexec/gnubin:$PATH"
==> Summary
🍺  /usr/local/Cellar/coreutils/8.32: 476 files, 12.5MB

 

3. 重新装就正常了

 

$ sudo gem install cocoapods
Password:
Building native extensions. This could take a while...
/Users/WeepYan/.rvm/rubies/ruby-2.6.0/lib/ruby/2.6.0/rubygems/ext/builder.rb:76: warning: Insecure world writable dir /usr/local/mysql in PATH, mode 040777
Successfully installed ffi-1.13.1
Successfully installed ethon-0.12.0
Successfully installed typhoeus-1.4.0
Successfully installed public_suffix-4.0.6
Successfully installed addressable-2.7.0
Successfully installed cocoapods-core-1.10.0
Successfully installed cocoapods-deintegrate-1.0.4
Successfully installed cocoapods-downloader-1.4.0
Successfully installed cocoapods-trunk-1.5.0
Successfully installed nanaimo-0.3.0
Successfully installed xcodeproj-1.19.0
Successfully installed fourflusher-2.3.1
Successfully installed ruby-macho-1.4.0
Successfully installed cocoapods-1.10.0
Parsing documentation for ffi-1.13.1
Installing ri documentation for ffi-1.13.1
Parsing documentation for ethon-0.12.0
Installing ri documentation for ethon-0.12.0
Parsing documentation for typhoeus-1.4.0
Installing ri documentation for typhoeus-1.4.0
Parsing documentation for public_suffix-4.0.6
Installing ri documentation for public_suffix-4.0.6
Parsing documentation for addressable-2.7.0
Installing ri documentation for addressable-2.7.0
Parsing documentation for cocoapods-core-1.10.0
Installing ri documentation for cocoapods-core-1.10.0
Parsing documentation for cocoapods-deintegrate-1.0.4
Installing ri documentation for cocoapods-deintegrate-1.0.4
Parsing documentation for cocoapods-downloader-1.4.0
Installing ri documentation for cocoapods-downloader-1.4.0
Parsing documentation for cocoapods-trunk-1.5.0
Installing ri documentation for cocoapods-trunk-1.5.0
Parsing documentation for nanaimo-0.3.0
Installing ri documentation for nanaimo-0.3.0
Parsing documentation for xcodeproj-1.19.0
Installing ri documentation for xcodeproj-1.19.0
Parsing documentation for fourflusher-2.3.1
Installing ri documentation for fourflusher-2.3.1
Parsing documentation for ruby-macho-1.4.0
Installing ri documentation for ruby-macho-1.4.0
Parsing documentation for cocoapods-1.10.0
Installing ri documentation for cocoapods-1.10.0
Done installing documentation for ffi, ethon, typhoeus, public_suffix, addressable, cocoapods-core, cocoapods-deintegrate, cocoapods-downloader, cocoapods-trunk, nanaimo, xcodeproj, fourflusher, ruby-macho, cocoapods after 31 seconds
14 gems installed

 

4. pod setup 失败

 

$ pod setup
/Users/WeepYan/.rvm/rubies/ruby-2.6.0/lib/ruby/gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/executable.rb:93: warning: Insecure world writable dir /usr/local/mysql in PATH, mode 040777
Setup completed

 

5. 解决方案 https://www.cnblogs.com/huaida/p/12701080.html

 

二、CocoaPods使用 pod install 问题

a) 原因是本地库没有该版本的第三方库

 

 

b) 使用命令 $pod install --repo-update 更新本地库

 

c) 再次执行正常

 

三、查看pod源并移除trunk源

1. 使用 $ pod --version 查看版本

2. 使用 $ pod repo list 查看源

3. 使用 $ pod repo remove trunk 移除 trunk 源

 

 

四、ruby警告问题 warning: Insecure world writable dir /usr/local/mysql in PATH, mode 040777

1. 产生场景

  不仅仅是pod场景,其它场景也一样。

$ pod search MB
/Users/WeepYan/.rvm/rubies/ruby-2.6.0/lib/ruby/gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/executable.rb:93: warning: Insecure world writable dir /usr/local/mysql in PATH, mode 040777
Setup completed

2. 原因分析

  报这个错的本质原因:文件夹 /usr/local/mysql 是需要不可写的,但是目前是可写入的,所以有写入安全隐患,所以报警告。

3. 解决方案

  命令行输入 sudo chmod go-w /usr/local/mysql 并输入电脑密码即可消除警告。

$ sudo chmod go-w /usr/local/mysql
Password:

   再次执行 pod search MB 发现警告没有了,很多跟pod相关的警告都可以类似解决。

4. sudo chmod go-w 命令分析

  sudo 是管理员权限

  chmod 修改文件或文件夹权限

  g 是group,表示组权限

  o 是other,表示其它用户

  - 删除权限

  + 增加权限

  w 写权限

  r 读权限

  x 可执行权限

5. 恢复警告

  如果要恢复警告,可执行命令 sudo chmod go+w /usr/local/mysql  这样警告就又出现了。

 

 

  当然咱们的目的是消除警告,测试只是为了更好的理解命令。

6. 参考文档

  理解chown||chmod go-w

  linux语句:chmod g-w aut.txt这句话是什么意思?

ok

posted @ 2021-03-30 16:58  画梦  阅读(2918)  评论(0编辑  收藏  举报