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


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM